Skip to content

Commit

Permalink
call exception view before triggering _unaothorized, as proposed by l…
Browse files Browse the repository at this point in the history
  • Loading branch information
tschorr authored and davisagli committed Oct 2, 2018
1 parent a45e268 commit fe246b9
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit fe246b9

Please sign in to comment.