Fix py26 and py27 unicode handling for tz type

This commit is contained in:
Konsta Vesterinen
2014-04-07 23:35:31 +03:00
parent 2c4c45da7c
commit 1481d8cd40

View File

@@ -19,7 +19,8 @@ class TimezoneType(types.TypeDecorator, ScalarCoercible):
class User(Base): class User(Base):
__tablename__ = 'user' __tablename__ = 'user'
# Pass backend='pytz' to change it to use pytz (dateutil by default) # Pass backend='pytz' to change it to use pytz (dateutil by
# default)
timezone = sa.Column(TimezoneType(backend='pytz')) timezone = sa.Column(TimezoneType(backend='pytz'))
""" """
@@ -40,7 +41,7 @@ class TimezoneType(types.TypeDecorator, ScalarCoercible):
self.python_type = tzfile self.python_type = tzfile
self._to = gettz self._to = gettz
self._from = lambda x: x._filename self._from = lambda x: six.text_type(x._filename)
except ImportError: except ImportError:
raise ImproperlyConfigured( raise ImproperlyConfigured(