From: Andreas Zeidler Date: Wed, 4 Jun 2014 09:50:11 +0000 (+0200) Subject: (hopefully) make the code a bit more readable X-Git-Tag: rel_0_6_6~6^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dddfffc737c6e58f8949117b059c4ef13b2b72c3;p=thirdparty%2Fsqlalchemy%2Falembic.git (hopefully) make the code a bit more readable --- diff --git a/alembic/autogenerate/render.py b/alembic/autogenerate/render.py index 7f58f966..a8b889ee 100644 --- a/alembic/autogenerate/render.py +++ b/alembic/autogenerate/render.py @@ -377,19 +377,14 @@ def _fk_colspec(fk, metadata_schema): never tries to resolve the remote table. """ - if metadata_schema is None: - return fk._get_colspec() - else: + colspec = fk._get_colspec() + if metadata_schema is not None and colspec.count(".") == 1: # need to render schema breaking up tokens by hand, since the # ForeignKeyConstraint here may not actually have a remote # Table present - colspec = fk._get_colspec() - tokens = colspec.split(".") # no schema in the colspec, render it - if len(tokens) == 2: - return "%s.%s" % (metadata_schema, colspec) - else: - return colspec + colspec = "%s.%s" % (metadata_schema, colspec) + return colspec def _render_foreign_key(constraint, autogen_context): rendered = _user_defined_render("foreign_key", constraint, autogen_context)