From fbd81de0ebdbc54b0df6ba08cc8309e1328888fa Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 11 Dec 2012 16:31:41 -0500 Subject: Fixed a regression caused by :ticket:`2410` whereby a :class:`.CheckConstraint` would apply itself back to the original table during a :meth:`.Table.tometadata` operation, as it would parse the SQL expression for a parent table. The operation now copies the given expression to correspond to the new table. [ticket:2633] --- lib/sqlalchemy/util/langhelpers.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/sqlalchemy/util/langhelpers.py') diff --git a/lib/sqlalchemy/util/langhelpers.py b/lib/sqlalchemy/util/langhelpers.py index f43cb0b3a..203b39c37 100644 --- a/lib/sqlalchemy/util/langhelpers.py +++ b/lib/sqlalchemy/util/langhelpers.py @@ -303,6 +303,8 @@ def generic_repr(obj, additional_kw=(), to_inspect=None): if to_inspect is None: to_inspect = obj + missing = object() + def genargs(): try: (args, vargs, vkw, defaults) = \ @@ -322,16 +324,16 @@ def generic_repr(obj, additional_kw=(), to_inspect=None): yield repr(getattr(obj, arg, None)) for (arg, defval) in zip(args[-default_len:], defaults): try: - val = getattr(obj, arg, None) - if val != defval: + val = getattr(obj, arg, missing) + if val is not missing and val != defval: yield '%s=%r' % (arg, val) except: pass if additional_kw: for arg, defval in additional_kw: try: - val = getattr(obj, arg, None) - if val != defval: + val = getattr(obj, arg, missing) + if val is not missing and val != defval: yield '%s=%r' % (arg, val) except: pass -- cgit v1.2.1