Permalink
Browse files

- Fix ``pyramid.config.preserve_view_attrs`` to not choke when the vi…

…ew it is

  passed is ``None`` (FBO: pyramid_formish).
  • Loading branch information...
1 parent 0cbf22f commit 8c900d2de7647f275b7bc140d8e401c38ca3260e @mcdonc mcdonc committed Aug 17, 2011
Showing with 18 additions and 0 deletions.
  1. +9 −0 CHANGES.txt
  2. +3 −0 pyramid/config.py
  3. +6 −0 pyramid/tests/test_config.py
View
@@ -1,3 +1,12 @@
+Next release
+============
+
+Bug Fixes
+---------
+
+- Fix ``pyramid.config.preserve_view_attrs`` to not choke when the view it is
+ passed is ``None`` (FBO: pyramid_formish).
+
1.1.1 (2011-08-13)
==================
View
@@ -2890,6 +2890,9 @@ def preserve_view_attrs(view, wrapper):
if wrapper is view:
return view
+ if view is None:
+ return wrapper
+
original_view = getattr(view, '__original_view__', None)
if original_view is None:
@@ -4689,6 +4689,12 @@ def view(context, request):
result = self._callFUT(view, view)
self.assertTrue(result is view)
+ def test_view_is_None(self):
+ def view(context, request):
+ """ """
+ result = self._callFUT(None, view)
+ self.assertTrue(result is view)
+
def test_it_different_with_existing_original_view(self):
def view1(context, request): pass
view1.__original_view__ = 'abc'

0 comments on commit 8c900d2

Please sign in to comment.