summaryrefslogtreecommitdiff
path: root/pecan/rest.py
diff options
context:
space:
mode:
authorRyan Petrello <lists@ryanpetrello.com>2014-09-23 18:17:48 -0400
committerRyan Petrello <lists@ryanpetrello.com>2014-09-24 18:00:08 -0400
commit9358e59af80d9c5f88d5713ca7d1e648bfad1403 (patch)
tree21f029f24b8a4b89db3e4c6c4acc52b0d99e7630 /pecan/rest.py
parent548ac35e3bc85ce8a872c4ec9adf4e39557187ce (diff)
downloadpecan-9358e59af80d9c5f88d5713ca7d1e648bfad1403.tar.gz
Improve argspec detection and leniency for wrapped controllers.
Pecan makes abundant use of `inspect.getargspec`, but unless you're very meticulous in the decorators you wrap your controllers with, the original argspec is not persisted (and pecan functionality can break in various ways). When a controller is decorated in a way that breaks argspec, we should instead attempt to locate the *actual* argspec for the method (not the wrapped function) and use it. Additionally, when controllers are missing **kwargs in the method signature to map optional GET and POST arguments, we shouldn't consider that a non-routable offense (an HTTP 400); instead, we should just *not* pass extraneous arguments to the function. Change-Id: I47fe0496ff6aa105359ee8e5b99f6c80476cc2e9
Diffstat (limited to 'pecan/rest.py')
-rw-r--r--pecan/rest.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/pecan/rest.py b/pecan/rest.py
index 48ca1f2..9406ad4 100644
--- a/pecan/rest.py
+++ b/pecan/rest.py
@@ -1,4 +1,4 @@
-from inspect import getargspec, ismethod
+from inspect import ismethod
import warnings
from webob import exc
@@ -7,7 +7,7 @@ import six
from .core import abort
from .decorators import expose
from .routing import lookup_controller, handle_lookup_traversal
-from .util import iscontroller
+from .util import iscontroller, getargspec
class RestController(object):