Merge branch 'master' of github.com:kvesteri/sqlalchemy-utils

This commit is contained in:
Konsta Vesterinen
2014-10-07 10:28:51 +03:00
2 changed files with 5 additions and 2 deletions

View File

@@ -16,7 +16,7 @@ from .scalar_coercible import ScalarCoercible
class ArrowType(types.TypeDecorator, ScalarCoercible): class ArrowType(types.TypeDecorator, ScalarCoercible):
""" """
ArrowType provides way of saving Arrow_ objects into database. It ArrowType provides way of saving Arrow_ objects into database. It
automatically changes Arrow_ objects to datatime objects on the way in and automatically changes Arrow_ objects to datetime objects on the way in and
datetime objects back to Arrow_ objects on the way out (when querying datetime objects back to Arrow_ objects on the way out (when querying
database). ArrowType needs Arrow_ library installed. database). ArrowType needs Arrow_ library installed.

View File

@@ -107,7 +107,10 @@ class PhoneNumberType(types.TypeDecorator, ScalarCoercible):
def process_bind_param(self, value, dialect): def process_bind_param(self, value, dialect):
if value: if value:
return getattr(value, self.STORE_FORMAT) if isinstance(value, PhoneNumber):
return getattr(value, self.STORE_FORMAT)
else:
return getattr(PhoneNumber(value), self.STORE_FORMAT)
return value return value
def process_result_value(self, value, dialect): def process_result_value(self, value, dialect):