diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2014-04-10 21:14:50 +0200 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2014-04-10 23:22:13 +0200 |
| commit | 80f6cbbadbd33574c8b949a8fbc77a5e94398e54 (patch) | |
| tree | d30bb76e49a6e15d969c28d86a73f04350ec1944 | |
| parent | 1d3d2b9a2458cbf11b7e828fb59b3f2cb73d14fe (diff) | |
[1.6.x] Increased robustness of 58161e4e. Refs #22291.
Backport of ee837b9a from master
| -rw-r--r-- | django/db/transaction.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/django/db/transaction.py b/django/db/transaction.py index 921affc2d8..f6cadfc84b 100644 --- a/django/db/transaction.py +++ b/django/db/transaction.py @@ -302,7 +302,13 @@ class Atomic(object): try: connection.savepoint_commit(sid) except DatabaseError: - connection.savepoint_rollback(sid) + try: + connection.savepoint_rollback(sid) + except Error: + # If rolling back to a savepoint fails, mark for + # rollback at a higher level and avoid shadowing + # the original exception. + connection.needs_rollback = True raise else: # Commit transaction @@ -328,7 +334,7 @@ class Atomic(object): else: try: connection.savepoint_rollback(sid) - except DatabaseError: + except Error: # If rolling back to a savepoint fails, mark for # rollback at a higher level and avoid shadowing # the original exception. |
