Navigation Menu

Skip to content

Commit

Permalink
- Fix pyramid.config.preserve_view_attrs to not choke when the vi…
Browse files Browse the repository at this point in the history
…ew it is

  passed is ``None`` (FBO: pyramid_formish).
  • Loading branch information
mcdonc committed Aug 17, 2011
1 parent 0cbf22f commit 8c900d2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CHANGES.txt
@@ -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)
==================

Expand Down
3 changes: 3 additions & 0 deletions pyramid/config.py
Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions pyramid/tests/test_config.py
Expand Up @@ -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'
Expand Down

0 comments on commit 8c900d2

Please sign in to comment.