summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-09-24 17:31:52 -0400
committerChris McDonough <chrism@plope.com>2011-09-24 17:31:52 -0400
commitfb2e07d9ae44bb4e5450d4ed46e476959b67cd41 (patch)
tree6287c65773b0af8fdc84c6f630b834573f6d1801
parentf77eeaed37f8f3c17d3863564a7b9954e7f53d2c (diff)
parentda32aae493430ff686d83a298d1e8d763381d029 (diff)
downloadpyramid-fb2e07d9ae44bb4e5450d4ed46e476959b67cd41.tar.gz
pyramid-fb2e07d9ae44bb4e5450d4ed46e476959b67cd41.tar.bz2
pyramid-fb2e07d9ae44bb4e5450d4ed46e476959b67cd41.zip
Merge https://github.com/nmclean/pyramid into nmclean-master
-rw-r--r--pyramid/config/views.py5
-rw-r--r--pyramid/tests/test_config/test_views.py7
2 files changed, 9 insertions, 3 deletions
diff --git a/pyramid/config/views.py b/pyramid/config/views.py
index 0d29d4331..3da41861d 100644
--- a/pyramid/config/views.py
+++ b/pyramid/config/views.py
@@ -416,7 +416,7 @@ class DefaultViewMapper(object):
def requestonly(view, attr=None):
if attr is None:
attr = '__call__'
- if inspect.isfunction(view):
+ if inspect.isroutine(view):
fn = view
elif inspect.isclass(view):
try:
@@ -436,8 +436,7 @@ def requestonly(view, attr=None):
args = argspec[0]
- if hasattr(fn, 'im_func'):
- # it's an instance method
+ if inspect.ismethod(fn):
if not args:
return False
args = args[1:]
diff --git a/pyramid/tests/test_config/test_views.py b/pyramid/tests/test_config/test_views.py
index be5143d45..f4e69f4e1 100644
--- a/pyramid/tests/test_config/test_views.py
+++ b/pyramid/tests/test_config/test_views.py
@@ -1763,6 +1763,13 @@ class Test_requestonly(unittest.TestCase):
class Foo: pass
foo = Foo()
self.assertFalse(self._callFUT(foo))
+
+ def test_method_onearg_named_request(self):
+ class Foo:
+ def method(self, request):
+ """ """
+ foo = Foo()
+ self.assertTrue(self._callFUT(foo.method))
class Test_isexception(unittest.TestCase):
def _callFUT(self, ob):