summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pecan/core.py4
-rw-r--r--pecan/tests/test_base.py10
2 files changed, 13 insertions, 1 deletions
diff --git a/pecan/core.py b/pecan/core.py
index 1c1da68..ad32525 100644
--- a/pecan/core.py
+++ b/pecan/core.py
@@ -343,7 +343,9 @@ class PecanBase(object):
args = []
varargs = []
kwargs = dict()
- valid_args = argspec.args[1:] # pop off `self`
+ valid_args = argspec.args[:]
+ if ismethod(state.controller) or im_self:
+ valid_args.pop(0) # pop off `self`
pecan_state = state.request.pecan
def _decode(x):
diff --git a/pecan/tests/test_base.py b/pecan/tests/test_base.py
index 6cc0f3c..a886a94 100644
--- a/pecan/tests/test_base.py
+++ b/pecan/tests/test_base.py
@@ -395,6 +395,11 @@ class TestControllerArguments(PecanTestCase):
', '.join(list(args) + data)
)
+ @staticmethod
+ @expose()
+ def static(id):
+ return "id is %s" % id
+
@expose()
def _route(self, args, request):
if hasattr(self, args[0]):
@@ -918,6 +923,11 @@ class TestControllerArguments(PecanTestCase):
assert r.status_int == 200
assert r.body == b_('variable_kwargs: list=%s' % l)
+ def test_staticmethod(self):
+ r = self.app_.get('/static/foobar')
+ assert r.status_int == 200
+ assert r.body == b_('id is foobar')
+
def test_no_remainder(self):
try:
r = self.app_.get('/eater')