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):
|
elif isinstance(value, datetime):
|
||||||
value = arrow.get(value)
|
value = arrow.get(value)
|
||||||
return 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:
|
if value is not None:
|
||||||
return value.lower()
|
return value.lower()
|
||||||
return value
|
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):
|
def _coerce(self, value):
|
||||||
return ip_address(value) if value else None
|
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
|
return value
|
||||||
|
|
||||||
|
@property
|
||||||
|
def python_type(self):
|
||||||
|
return self.impl.type.python_type
|
||||||
|
|
||||||
|
|
||||||
Password.associate_with(PasswordType)
|
Password.associate_with(PasswordType)
|
||||||
|
@@ -61,3 +61,7 @@ class URLType(types.TypeDecorator, ScalarCoercible):
|
|||||||
if value is not None and not isinstance(value, furl):
|
if value is not None and not isinstance(value, furl):
|
||||||
return furl(value)
|
return furl(value)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
@property
|
||||||
|
def python_type(self):
|
||||||
|
return self.impl.type.python_type
|
||||||
|
Reference in New Issue
Block a user