(hopefully) make the code a bit more readable

This commit is contained in:
Andreas Zeidler 2014-06-04 11:50:11 +02:00
parent 67ffed92c0
commit dddfffc737
1 changed files with 4 additions and 9 deletions

View File

@ -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)