summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/util/langhelpers.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-08-14 12:20:54 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2011-08-14 12:20:54 -0400
commit76a9219a1ebe9d6abdc510fec87968df905be4fe (patch)
tree8c7f0304d7806b7ebe30597059785e6eaa474ddc /lib/sqlalchemy/util/langhelpers.py
parent9a2edbf3ebf04bfff3ad2a7214605503d5cdcaa2 (diff)
downloadsqlalchemy-76a9219a1ebe9d6abdc510fec87968df905be4fe.tar.gz
- Added a slightly nicer __repr__() to SchemaItem
classes. Note the repr here can't fully support the "repr is the constructor" idea since schema items can be very deeply nested/cyclical, have late initialization of some things, etc. [ticket:2223]
Diffstat (limited to 'lib/sqlalchemy/util/langhelpers.py')
-rw-r--r--lib/sqlalchemy/util/langhelpers.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/sqlalchemy/util/langhelpers.py b/lib/sqlalchemy/util/langhelpers.py
index 11d4cdaf6..453cafd83 100644
--- a/lib/sqlalchemy/util/langhelpers.py
+++ b/lib/sqlalchemy/util/langhelpers.py
@@ -237,9 +237,12 @@ def generic_repr(obj):
for arg in args[1:-default_len]:
yield repr(getattr(obj, arg, None))
for (arg, defval) in zip(args[-default_len:], defaults):
- val = getattr(obj, arg, None)
- if val != defval:
- yield '%s=%r' % (arg, val)
+ try:
+ val = getattr(obj, arg, None)
+ if val != defval:
+ yield '%s=%r' % (arg, val)
+ except:
+ pass
return "%s(%s)" % (obj.__class__.__name__, ", ".join(genargs()))
class portable_instancemethod(object):