From e4656164776553437f69ff4ae409a711e83e1414 Mon Sep 17 00:00:00 2001 From: Ryan Leckey Date: Wed, 22 Oct 2014 05:53:12 -0700 Subject: [PATCH] Add a python_type constructor (used by EncryptedType) --- sqlalchemy_utils/types/phone_number.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sqlalchemy_utils/types/phone_number.py b/sqlalchemy_utils/types/phone_number.py index ed18792..d0f8d22 100644 --- a/sqlalchemy_utils/types/phone_number.py +++ b/sqlalchemy_utils/types/phone_number.py @@ -95,6 +95,9 @@ class PhoneNumberType(types.TypeDecorator, ScalarCoercible): STORE_FORMAT = 'e164' impl = types.Unicode(20) + def python_type(self, text): + return self._coerce(text) + def __init__(self, country_code='US', max_length=20, *args, **kwargs): # Bail if phonenumbers is not found. if phonenumbers is None: