summaryrefslogtreecommitdiff
path: root/pecan/core.py
diff options
context:
space:
mode:
authorRyan Petrello <lists@ryanpetrello.com>2014-09-01 19:15:25 -0400
committerRyan Petrello <lists@ryanpetrello.com>2014-09-22 17:18:26 -0400
commit1a546f0240ada065b56029d33f76c83b9fdc801a (patch)
tree10e6199a83ac5362e4be4ecbe7d73ac4b930849f /pecan/core.py
parent8b540587e9020cebf8ec8c30cfbd10379fd628e9 (diff)
downloadpecan-1a546f0240ada065b56029d33f76c83b9fdc801a.tar.gz
Fix a bug in generic function handling when context locals are disabled.
Fixes bug 1364113 Change-Id: I192c75b73ae95338dc2f1ea019e83a42fb8da87b
Diffstat (limited to 'pecan/core.py')
-rw-r--r--pecan/core.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/pecan/core.py b/pecan/core.py
index a52dae2..9174c50 100644
--- a/pecan/core.py
+++ b/pecan/core.py
@@ -684,15 +684,23 @@ class ExplicitPecan(PecanBase):
# When comparing the argspec of the method to GET/POST params,
# ignore the implicit (req, resp) at the beginning of the function
# signature
- signature_error = TypeError(
- 'When `use_context_locals` is `False`, pecan passes an explicit '
- 'reference to the request and response as the first two arguments '
- 'to the controller.\nChange the `%s.%s.%s` signature to accept '
- 'exactly 2 initial arguments (req, resp)' % (
+ if hasattr(state.controller, '__self__'):
+ _repr = '.'.join((
state.controller.__self__.__class__.__module__,
state.controller.__self__.__class__.__name__,
state.controller.__name__
- )
+ ))
+ else:
+ _repr = '.'.join((
+ state.controller.__module__,
+ state.controller.__name__
+ ))
+
+ signature_error = TypeError(
+ 'When `use_context_locals` is `False`, pecan passes an explicit '
+ 'reference to the request and response as the first two arguments '
+ 'to the controller.\nChange the `%s` signature to accept exactly '
+ '2 initial arguments (req, resp)' % _repr
)
try:
positional = argspec.args[:]