diff options
| author | Chris McDonough <chrism@plope.com> | 2012-11-04 01:02:19 -0500 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2012-11-04 01:02:19 -0500 |
| commit | 34d4cd0ea38fdbe0ab0e0832fc2114953ef4e94a (patch) | |
| tree | 81842595aefc26a45050b77d9a5c8fb18b98831b | |
| parent | 66fe1d05adbbcb07482972b4fd512676d68388ee (diff) | |
| download | pyramid-34d4cd0ea38fdbe0ab0e0832fc2114953ef4e94a.tar.gz pyramid-34d4cd0ea38fdbe0ab0e0832fc2114953ef4e94a.tar.bz2 pyramid-34d4cd0ea38fdbe0ab0e0832fc2114953ef4e94a.zip | |
- 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
Fixes #700
| -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) |
