From 4bf029dbf517887690a8730a96b5dab2158fd963 Mon Sep 17 00:00:00 2001 From: Konsta Vesterinen Date: Tue, 13 Aug 2013 12:24:04 +0300 Subject: [PATCH] Made Timezone type inherit ScalarCoercible --- sqlalchemy_utils/types/timezone.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sqlalchemy_utils/types/timezone.py b/sqlalchemy_utils/types/timezone.py index df0f6d4..3c2dfda 100644 --- a/sqlalchemy_utils/types/timezone.py +++ b/sqlalchemy_utils/types/timezone.py @@ -1,9 +1,10 @@ import six from sqlalchemy import types from sqlalchemy_utils import ImproperlyConfigured +from .scalar_coercible import ScalarCoercible -class TimezoneType(types.TypeDecorator): +class TimezoneType(types.TypeDecorator, ScalarCoercible): """ Changes Timezone objects to a string representation on the way in and changes them back to Timezone objects on the way out. @@ -64,9 +65,6 @@ class TimezoneType(types.TypeDecorator): return value - def coercion_listener(self, target, value, oldvalue, initiator): - return self._coerce(value) - def process_bind_param(self, value, dialect): return self._from(self._coerce(value)) if value else None