summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pyramid/config.py7
-rw-r--r--pyramid/tests/test_config.py15
2 files changed, 20 insertions, 2 deletions
diff --git a/pyramid/config.py b/pyramid/config.py
index 0699c7281..1f4b85de0 100644
--- a/pyramid/config.py
+++ b/pyramid/config.py
@@ -2798,8 +2798,11 @@ class ViewDeriver(object):
# this is a little silly but we don't want to decorate the original
# function with attributes that indicate accept, order, and phash,
# so we use a wrapper
- if ( (accept is None) and (order == MAX_ORDER) and
- (phash == DEFAULT_PHASH) ):
+ if (
+ (accept is None) and
+ (order == MAX_ORDER) and
+ (phash == DEFAULT_PHASH)
+ ):
return view # defaults
def attr_view(context, request):
return view(context, request)
diff --git a/pyramid/tests/test_config.py b/pyramid/tests/test_config.py
index 16b1f7eff..a862e2255 100644
--- a/pyramid/tests/test_config.py
+++ b/pyramid/tests/test_config.py
@@ -3658,6 +3658,21 @@ class TestViewDeriver(unittest.TestCase):
self.failIf(result is view)
self.assertEqual(result(None, None), 'OK')
+ def test_attr_wrapped_view_branching_default_phash(self):
+ from pyramid.config import DEFAULT_PHASH
+ def view(context, request):
+ return 'OK'
+ deriver = self._makeOne(phash=DEFAULT_PHASH)
+ result = deriver(view)
+ self.assertEqual(result, view)
+
+ def test_attr_wrapped_view_branching_nondefault_phash(self):
+ def view(context, request):
+ return 'OK'
+ deriver = self._makeOne(phash='nondefault')
+ result = deriver(view)
+ self.assertNotEqual(result, view)
+
class TestDefaultViewMapper(unittest.TestCase):
def setUp(self):
self.config = testing.setUp()