Added python_type implementation to arrow, email, ipaddress, password, and url types
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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)
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user