summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/util/langhelpers.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-12-11 16:31:41 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2012-12-11 16:31:41 -0500
commitfbd81de0ebdbc54b0df6ba08cc8309e1328888fa (patch)
tree2dd468791587e60966d5122f0c6cedabf22c1dea /lib/sqlalchemy/util/langhelpers.py
parentd9d6dcea77a848ed9acf5611abb4d00387737e17 (diff)
downloadsqlalchemy-fbd81de0ebdbc54b0df6ba08cc8309e1328888fa.tar.gz
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]
Diffstat (limited to 'lib/sqlalchemy/util/langhelpers.py')
-rw-r--r--lib/sqlalchemy/util/langhelpers.py10
1 files changed, 6 insertions, 4 deletions
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