From eb4a843318b4fa76d238c43a293d64af64ca1148 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 30 Mar 2011 14:22:41 -0400 Subject: [PATCH] some additional clarification on typeengine docs --- lib/sqlalchemy/types.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/sqlalchemy/types.py b/lib/sqlalchemy/types.py index 1a894ce63e..b52f7644c1 100644 --- a/lib/sqlalchemy/types.py +++ b/lib/sqlalchemy/types.py @@ -134,7 +134,7 @@ class TypeEngine(AbstractType): return self.__class__ def dialect_impl(self, dialect): - """Return a dialect-specific implementation for this type.""" + """Return a dialect-specific implementation for this :class:`.TypeEngine`.""" try: return dialect._type_memos[self]['impl'] @@ -454,6 +454,9 @@ class TypeDecorator(TypeEngine): In most cases this returns a dialect-adapted form of the :class:`.TypeEngine` type represented by ``self.impl``. + Makes usage of :meth:`dialect_impl` but also traverses + into wrapped :class:`.TypeDecorator` instances. + Behavior can be customized here by overriding :meth:`load_dialect_impl`. """ adapted = dialect.type_descriptor(self) @@ -465,10 +468,15 @@ class TypeDecorator(TypeEngine): return self.load_dialect_impl(dialect) def load_dialect_impl(self, dialect): - """User hook which can be overridden to provide a different 'impl' - type per-dialect. + """Return a :class:`.TypeEngine` object corresponding to a dialect. + + This is an end-user override hook that can be used to provide + differing types depending on the given dialect. It is used + by the :class:`.TypeDecorator` implementation of :meth:`type_engine` + to help determine what type should ultimately be returned + for a given :class:`.TypeDecorator`. - by default returns self.impl. + By default returns ``self.impl``. """ return self.impl -- 2.47.3