summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/util/langhelpers.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-10-18 12:29:41 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2012-10-18 12:29:41 -0400
commitba67f7dbc5eb7a1ed2a3e1b56df72a837130f7bb (patch)
tree973b833e6d31c076c25fb6c169b383f8e4cd0d7a /lib/sqlalchemy/util/langhelpers.py
parent2484ef34c27f3342e62bd6285bb3668e2c913090 (diff)
downloadsqlalchemy-ba67f7dbc5eb7a1ed2a3e1b56df72a837130f7bb.tar.gz
- [bug] TypeDecorator now includes a generic repr()
that works in terms of the "impl" type by default. This is a behavioral change for those TypeDecorator classes that specify a custom __init__ method; those types will need to re-define __repr__() if they need __repr__() to provide a faithful constructor representation. [ticket:2594]
Diffstat (limited to 'lib/sqlalchemy/util/langhelpers.py')
-rw-r--r--lib/sqlalchemy/util/langhelpers.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/sqlalchemy/util/langhelpers.py b/lib/sqlalchemy/util/langhelpers.py
index 9761aeae9..55b78090a 100644
--- a/lib/sqlalchemy/util/langhelpers.py
+++ b/lib/sqlalchemy/util/langhelpers.py
@@ -281,14 +281,16 @@ def unbound_method_to_callable(func_or_cls):
else:
return func_or_cls
-def generic_repr(obj, additional_kw=()):
+def generic_repr(obj, additional_kw=(), to_inspect=None):
"""Produce a __repr__() based on direct association of the __init__()
specification vs. same-named attributes present.
"""
+ if to_inspect is None:
+ to_inspect = obj
def genargs():
try:
- (args, vargs, vkw, defaults) = inspect.getargspec(obj.__init__)
+ (args, vargs, vkw, defaults) = inspect.getargspec(to_inspect.__init__)
except TypeError:
return