summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2016-02-09 20:51:35 -0500
committerChris McDonough <chrism@plope.com>2016-02-09 20:51:35 -0500
commitca529f0d7d3870d851181375f6a15805cef208b5 (patch)
treef9c15e5d6906cbfefb45d960161a040346304795
parent7d8175fe8f893668f6061e2a26f9c673c2f00ccc (diff)
downloadpyramid-ca529f0d7d3870d851181375f6a15805cef208b5.tar.gz
pyramid-ca529f0d7d3870d851181375f6a15805cef208b5.tar.bz2
pyramid-ca529f0d7d3870d851181375f6a15805cef208b5.zip
bring into line with excview
-rw-r--r--pyramid/view.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/pyramid/view.py b/pyramid/view.py
index edf3d8585..2555cbe30 100644
--- a/pyramid/view.py
+++ b/pyramid/view.py
@@ -596,10 +596,17 @@ class ViewMethodsMixin(object):
registry = get_current_registry()
if exc_info is None:
exc_info = traceback.exc_info()
+ attrs = request.__dict__
context_iface = providedBy(exc_info[0])
- view_name = getattr(request, 'view_name', '')
- request.exception = exc_info[0]
- request.exc_info = exc_info
+ view_name = attrs.get('view_name', '')
+ # probably need something like "with temporarily_munged_request(req)"
+ # here, which adds exception and exc_info as request attrs, and
+ # removes response object temporarily (as per the excview tween)
+ attrs['exception'] = exc_info[0]
+ attrs['exc_info'] = request.exc_info = exc_info
+ # we use .get instead of .__getitem__ below due to
+ # https://github.com/Pylons/pyramid/issues/700
+ request_iface = attrs.get('request_iface', IRequest)
response = _call_view(
registry,
request,
@@ -609,6 +616,6 @@ class ViewMethodsMixin(object):
view_types=None,
view_classifier=IExceptionViewClassifier,
secure=secure,
- request_iface=None,
+ request_iface=request_iface.combined,
)
return response