Fixed #8315 -- If an exception is raised whilst trying to rollback a
transaction (after another exception in the code), make sure the original exception is reported, rather than the rollback-generated one. The latter is almost certainly a consequence of the former. Patch from Karen Tracey. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8411 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
54f9a98713
commit
844089de07
|
@ -53,5 +53,8 @@ signals.request_started.connect(reset_queries)
|
||||||
# when a Django request has an exception.
|
# when a Django request has an exception.
|
||||||
def _rollback_on_exception(**kwargs):
|
def _rollback_on_exception(**kwargs):
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
|
try:
|
||||||
transaction.rollback_unless_managed()
|
transaction.rollback_unless_managed()
|
||||||
|
except DatabaseError:
|
||||||
|
pass
|
||||||
signals.got_request_exception.connect(_rollback_on_exception)
|
signals.got_request_exception.connect(_rollback_on_exception)
|
||||||
|
|
Loading…
Reference in New Issue