Added python_type implementation to arrow, email, ipaddress, password, and url types

This commit is contained in:
Kelvin Hammond
2015-05-05 19:19:26 -04:00
parent 64714c9a0c
commit 686216b0cd
5 changed files with 20 additions and 0 deletions

View File

@@ -85,3 +85,7 @@ class ArrowType(types.TypeDecorator, ScalarCoercible):
elif isinstance(value, datetime):
value = arrow.get(value)
return value
@property
def python_type(self):
return self.impl.type.python_type

View File

@@ -11,3 +11,7 @@ class EmailType(sa.types.TypeDecorator):
if value is not None:
return value.lower()
return value
@property
def python_type(self):
return self.impl.type.python_type

View File

@@ -67,3 +67,7 @@ class IPAddressType(types.TypeDecorator, ScalarCoercible):
def _coerce(self, value):
return ip_address(value) if value else None
@property
def python_type(self):
return self.impl.type.python_type

View File

@@ -208,5 +208,9 @@ class PasswordType(types.TypeDecorator, ScalarCoercible):
return value
@property
def python_type(self):
return self.impl.type.python_type
Password.associate_with(PasswordType)

View File

@@ -61,3 +61,7 @@ class URLType(types.TypeDecorator, ScalarCoercible):
if value is not None and not isinstance(value, furl):
return furl(value)
return value
@property
def python_type(self):
return self.impl.type.python_type