diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-11-13 20:38:56 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-11-13 20:38:56 +0000 |
| commit | f3de4d545fc53bb3bb3b4b5e28c9dee79f017cc4 (patch) | |
| tree | 4ba5d86607ab13bce186fa9bbd2875573a8be2e5 /lib/sqlalchemy | |
| parent | 0148adec3069c64f3dca8d269e4c0fac3fe6bcaf (diff) | |
| download | sqlalchemy-f3de4d545fc53bb3bb3b4b5e28c9dee79f017cc4.tar.gz | |
- Rearranged the `load_dialect_impl()` method in
`TypeDecorator` such that it will take effect
even if the user-defined `TypeDecorator` uses
another `TypeDecorator` as its impl.
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/types.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/sqlalchemy/types.py b/lib/sqlalchemy/types.py index fe6cc7b53..084ec5117 100644 --- a/lib/sqlalchemy/types.py +++ b/lib/sqlalchemy/types.py @@ -152,13 +152,11 @@ class TypeDecorator(AbstractType): except KeyError: pass - if isinstance(self.impl, TypeDecorator): - typedesc = self.impl.dialect_impl(dialect) - else: - typedesc = self.load_dialect_impl(dialect) + typedesc = self.load_dialect_impl(dialect) tt = self.copy() if not isinstance(tt, self.__class__): - raise AssertionError("Type object %s does not properly implement the copy() method, it must return an object of type %s" % (self, self.__class__)) + raise AssertionError("Type object %s does not properly implement the copy() " + "method, it must return an object of type %s" % (self, self.__class__)) tt.impl = typedesc self._impl_dict[dialect] = tt return tt @@ -170,7 +168,10 @@ class TypeDecorator(AbstractType): can be overridden to provide different behavior. """ - return dialect.type_descriptor(self.impl) + if isinstance(self.impl, TypeDecorator): + return self.impl.dialect_impl(dialect) + else: + return dialect.type_descriptor(self.impl) def __getattr__(self, key): """Proxy all other undefined accessors to the underlying implementation.""" |
