summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-03-28 07:14:51 -0400
committerChris McDonough <chrism@plope.com>2011-03-28 07:14:51 -0400
commitf168197609169fb01b65adeb3eb59d069000fe2c (patch)
tree3f065295030b0440d421233a02db96cff010ee7d
parent2b701d9f3a6d6bc3bb5c54ed035b1cd353dc9203 (diff)
downloadpyramid-f168197609169fb01b65adeb3eb59d069000fe2c.tar.gz
pyramid-f168197609169fb01b65adeb3eb59d069000fe2c.tar.bz2
pyramid-f168197609169fb01b65adeb3eb59d069000fe2c.zip
branch coverage
-rw-r--r--pyramid/config.py7
-rw-r--r--pyramid/tests/test_config.py6
2 files changed, 11 insertions, 2 deletions
diff --git a/pyramid/config.py b/pyramid/config.py
index 047a9d2de..0699c7281 100644
--- a/pyramid/config.py
+++ b/pyramid/config.py
@@ -2949,7 +2949,6 @@ def requestonly(view, attr=None):
return False
args = argspec[0]
- defaults = argspec[3]
if hasattr(fn, 'im_func'):
# it's an instance method
@@ -2962,7 +2961,11 @@ def requestonly(view, attr=None):
if len(args) == 1:
return True
- elif args[0] == 'request':
+ defaults = argspec[3]
+ if defaults is None:
+ defaults = ()
+
+ if args[0] == 'request':
if len(args) - len(defaults) == 1:
return True
diff --git a/pyramid/tests/test_config.py b/pyramid/tests/test_config.py
index ec0a7f7de..16b1f7eff 100644
--- a/pyramid/tests/test_config.py
+++ b/pyramid/tests/test_config.py
@@ -4407,6 +4407,12 @@ class Test_requestonly(unittest.TestCase):
""" """
self.assertTrue(self._callFUT(foo))
+ def test_newstyle_class_init_firstname_request_with_secondname(self):
+ class foo(object):
+ def __init__(self, request, two):
+ """ """
+ self.assertFalse(self._callFUT(foo))
+
def test_newstyle_class_init_noargs(self):
class foo(object):
def __init__():