Commit abf2ac13 authored by Vincent Pelletier's avatar Vincent Pelletier

ERP5Type/patches/WSGIPublisher: Ensure transaction abort.

Transaction must be aborted even if the state is getting so bad that the
exception is being re-raised. Leaving an open-ended transaction is never
acceptable.
parent 18b5e4ed
...@@ -279,6 +279,7 @@ def transaction_pubevents(request, response, err_hook, tm=transaction.manager): ...@@ -279,6 +279,7 @@ def transaction_pubevents(request, response, err_hook, tm=transaction.manager):
# Create new exc_info with the upgraded exception. # Create new exc_info with the upgraded exception.
exc_info = (exc_type, exc, sys.exc_info()[2]) exc_info = (exc_type, exc, sys.exc_info()[2])
try:
try: try:
# Raise exception from app if handle-errors is False # Raise exception from app if handle-errors is False
# (set by zope.testbrowser in some cases) # (set by zope.testbrowser in some cases)
...@@ -323,7 +324,7 @@ def transaction_pubevents(request, response, err_hook, tm=transaction.manager): ...@@ -323,7 +324,7 @@ def transaction_pubevents(request, response, err_hook, tm=transaction.manager):
response.setStatus(exc.getStatus()) response.setStatus(exc.getStatus())
retry = isinstance(exc, TransientError) and request.supports_retry() retry = isinstance(exc, TransientError) and request.supports_retry()
finally:
notify(pubevents.PubBeforeAbort(request, exc_info, retry)) notify(pubevents.PubBeforeAbort(request, exc_info, retry))
tm.abort() tm.abort()
notify(pubevents.PubFailure(request, exc_info, retry)) notify(pubevents.PubFailure(request, exc_info, retry))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment