diff options
| author | Alex Gaynor <alex.gaynor@gmail.com> | 2010-10-24 17:25:49 +0000 |
|---|---|---|
| committer | Alex Gaynor <alex.gaynor@gmail.com> | 2010-10-24 17:25:49 +0000 |
| commit | 01e2be557bd41134e182a26bd705ff2039cef2b9 (patch) | |
| tree | f96dee3a05e387979201b155e30f827a5ec259d9 /django | |
| parent | eccc42a8c79c1353e4072207b4a5259afdd50aca (diff) | |
Fixed #14550 -- fixed the behavior of commit_on_success to exit the transaction properly. This was a bug introduced in [14288]. Thanks to Justin for the report and Florian Apolloner for help debugging.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14343 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/transaction.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/django/db/transaction.py b/django/db/transaction.py index 7827d04e9b..248cb65cb7 100644 --- a/django/db/transaction.py +++ b/django/db/transaction.py @@ -345,16 +345,19 @@ def commit_on_success(using=None): managed(True, using=using) def exiting(exc_value, using): - if exc_value is not None: - if is_dirty(using=using): - rollback(using=using) - else: - if is_dirty(using=using): - try: - commit(using=using) - except: + try: + if exc_value is not None: + if is_dirty(using=using): rollback(using=using) - raise + else: + if is_dirty(using=using): + try: + commit(using=using) + except: + rollback(using=using) + raise + finally: + leave_transaction_management(using=using) return _transaction_func(entering, exiting, using) |
