From: Mike Bayer Date: Sun, 23 Oct 2011 17:42:02 +0000 (-0400) Subject: fix the 2to3 here X-Git-Tag: rel_0_7_4~74 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ef278ec7557a5b3446807e9bc16624630ffd034;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git fix the 2to3 here --- diff --git a/lib/sqlalchemy/schema.py b/lib/sqlalchemy/schema.py index 3d00b31979..7ab008a107 100644 --- a/lib/sqlalchemy/schema.py +++ b/lib/sqlalchemy/schema.py @@ -322,27 +322,30 @@ class Table(SchemaItem, expression.TableClause): # we do it after the table is in the singleton dictionary to support # circular foreign keys if autoload: - if autoload_with: - autoload_with.run_callable( - autoload_with.dialect.reflecttable, - self, include_columns - ) - else: - bind = _bind_or_error(metadata, - msg="No engine is bound to this Table's MetaData. " - "Pass an engine to the Table via " - "autoload_with=, " - "or associate the MetaData with an engine via " - "metadata.bind=") - bind.run_callable( - bind.dialect.reflecttable, - self, include_columns - ) + self._autoload(metadata, autoload_with, include_columns) # initialize all the column, etc. objects. done after reflection to # allow user-overrides self._init_items(*args) + def _autoload(self, metadata, autoload_with, include_columns): + if autoload_with: + autoload_with.run_callable( + autoload_with.dialect.reflecttable, + self, include_columns + ) + else: + bind = _bind_or_error(metadata, + msg="No engine is bound to this Table's MetaData. " + "Pass an engine to the Table via " + "autoload_with=, " + "or associate the MetaData with an engine via " + "metadata.bind=") + bind.run_callable( + bind.dialect.reflecttable, + self, include_columns + ) + @property def _sorted_constraints(self): """Return the set of constraints as a list, sorted by creation order.""" @@ -371,6 +374,9 @@ class Table(SchemaItem, expression.TableClause): if 'info' in kwargs: self.info = kwargs.pop('info') + if autoload: + self._autoload(self.metadata, autoload_with, include_columns) + self._extra_kwargs(**kwargs) self._init_items(*args) diff --git a/lib/sqlalchemy/types.py b/lib/sqlalchemy/types.py index e58313466a..af98dd8139 100644 --- a/lib/sqlalchemy/types.py +++ b/lib/sqlalchemy/types.py @@ -1584,7 +1584,7 @@ class _Binary(TypeEngine): @property def python_type(self): - #Py3K + # Py3K #return bytes # Py2K return str