Browse files

branch coverage

  • Loading branch information...
1 parent 2b701d9 commit f168197609169fb01b65adeb3eb59d069000fe2c @mcdonc mcdonc committed Mar 28, 2011
Showing with 11 additions and 2 deletions.
  1. +5 −2 pyramid/config.py
  2. +6 −0 pyramid/tests/test_config.py
View
7 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
View
6 pyramid/tests/test_config.py
@@ -4407,6 +4407,12 @@ def __init__(self, request, foo=1, bar=2):
""" """
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__():

0 comments on commit f168197

Please sign in to comment.