summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/util.py
diff options
context:
space:
mode:
authorJason Kirtland <jek@discorporate.us>2008-06-29 18:58:11 +0000
committerJason Kirtland <jek@discorporate.us>2008-06-29 18:58:11 +0000
commiteaa4328aacf10978a70382db01f570b0dfac4eba (patch)
tree42861f88ae5a42ee8498bb9e3d4c91fb4a5543de /lib/sqlalchemy/util.py
parent8755dc3d66db0673050997467fb89c23e382b50e (diff)
downloadsqlalchemy-eaa4328aacf10978a70382db01f570b0dfac4eba.tar.gz
- consider args[0] as self when introspecting def(*args): ... [ticket:1091]
Diffstat (limited to 'lib/sqlalchemy/util.py')
-rw-r--r--lib/sqlalchemy/util.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/sqlalchemy/util.py b/lib/sqlalchemy/util.py
index e0bf45b67..dea320724 100644
--- a/lib/sqlalchemy/util.py
+++ b/lib/sqlalchemy/util.py
@@ -345,7 +345,8 @@ def format_argspec_plus(fn, grouped=True):
args
Full inspect.formatargspec for fn
self_arg
- The name of the first positional argument, or None
+ The name of the first positional argument, varargs[0], or None
+ if the function defines no positional arguments.
apply_pos
args, re-written in calling rather than receiving syntax. Arguments are
passed positionally.
@@ -363,7 +364,12 @@ def format_argspec_plus(fn, grouped=True):
"""
spec = inspect.getargspec(fn)
args = inspect.formatargspec(*spec)
- self_arg = spec[0] and spec[0][0] or None
+ if spec[0]:
+ self_arg = spec[0][0]
+ elif spec[1]:
+ self_arg = '%s[0]' % spec[1]
+ else:
+ self_arg = None
apply_pos = inspect.formatargspec(spec[0], spec[1], spec[2])
defaulted_vals = spec[3] is not None and spec[0][0-len(spec[3]):] or ()
apply_kw = inspect.formatargspec(spec[0], spec[1], spec[2], defaulted_vals,