Fix py26 and py27 unicode handling for tz type
This commit is contained in:
@@ -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(
|
||||||
|
Reference in New Issue
Block a user