Made Timezone type inherit ScalarCoercible
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
import six
|
import six
|
||||||
from sqlalchemy import types
|
from sqlalchemy import types
|
||||||
from sqlalchemy_utils import ImproperlyConfigured
|
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 Timezone objects to a string representation on the way in and
|
||||||
changes them back to Timezone objects on the way out.
|
changes them back to Timezone objects on the way out.
|
||||||
@@ -64,9 +65,6 @@ class TimezoneType(types.TypeDecorator):
|
|||||||
|
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def coercion_listener(self, target, value, oldvalue, initiator):
|
|
||||||
return self._coerce(value)
|
|
||||||
|
|
||||||
def process_bind_param(self, value, dialect):
|
def process_bind_param(self, value, dialect):
|
||||||
return self._from(self._coerce(value)) if value else None
|
return self._from(self._coerce(value)) if value else None
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user