diff options
| -rw-r--r-- | CHANGES.txt | 5 | ||||
| -rw-r--r-- | pyramid/tweens.py | 5 |
2 files changed, 9 insertions, 1 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 298bddf7a..8d5a00e77 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -38,6 +38,11 @@ Bug Fixes be unmolested on the way out. See https://github.com/Pylons/pyramid/issues/709 +- In uncommon cases, the ``pyramid_excview_tween_factory`` might have + inadvertently raised a ``KeyError`` looking for ``request_iface`` as an + attribute of the request. It no longer fails in this case. See + https://github.com/Pylons/pyramid/issues/700 + Internals --------- diff --git a/pyramid/tweens.py b/pyramid/tweens.py index 73a95e1b8..cf2238deb 100644 --- a/pyramid/tweens.py +++ b/pyramid/tweens.py @@ -2,6 +2,7 @@ import sys from pyramid.interfaces import ( IExceptionViewClassifier, + IRequest, IView, ) @@ -28,7 +29,9 @@ def excview_tween_factory(handler, registry): # sane (e.g. caching headers) if 'response' in attrs: del attrs['response'] - request_iface = attrs['request_iface'] + # we use .get instead of .__getitem__ below due to + # https://github.com/Pylons/pyramid/issues/700 + request_iface = attrs.get('request_iface', IRequest) provides = providedBy(exc) for_ = (IExceptionViewClassifier, request_iface.combined, provides) view_callable = adapters.lookup(for_, IView, default=None) |
