Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create exception view before handling Unauthorized #304

Merged
merged 7 commits into from Oct 2, 2018
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/ZPublisher/WSGIPublisher.py
Expand Up @@ -149,6 +149,10 @@ def transaction_pubevents(request, response, tm=transaction.manager):
if request.environ.get('x-wsgiorg.throw_errors', False):
reraise(*exc_info)

# Handle exception view
exc_view_created = _exc_view_created_response(
exc, request, response)

if isinstance(exc, Unauthorized):
# _unauthorized modifies the response in-place. If this hook
# is used, an exception view for Unauthorized has to merge
Expand All @@ -157,10 +161,6 @@ def transaction_pubevents(request, response, tm=transaction.manager):
response._unauthorized()
response.setStatus(exc.getStatus())

# Handle exception view
exc_view_created = _exc_view_created_response(
exc, request, response)

notify(pubevents.PubBeforeAbort(
request, exc_info, request.supports_retry()))
tm.abort()
Expand Down