summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-03-28 07:25:39 -0400
committerChris McDonough <chrism@plope.com>2011-03-28 07:25:39 -0400
commit82ddac818b486383438f72d49c16aaaa185029fc (patch)
tree9a3a42643205fdc222f77b5ad0dfa007cc849639
parentf168197609169fb01b65adeb3eb59d069000fe2c (diff)
downloadpyramid-82ddac818b486383438f72d49c16aaaa185029fc.tar.gz
pyramid-82ddac818b486383438f72d49c16aaaa185029fc.tar.bz2
pyramid-82ddac818b486383438f72d49c16aaaa185029fc.zip
branch coverage
-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()