summaryrefslogtreecommitdiff
path: root/django/db/transaction.py
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-03-12 14:10:01 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-03-12 14:10:01 +0000
commitef0be292a687f95f1081b2ff8170fd7cbd5a365f (patch)
tree6d731bf5ca7c5eeec5821125a3af3310044cff64 /django/db/transaction.py
parent615eab6b0255608e2094f0ecf02c5351a1e887cc (diff)
Fixed #11900 -- Corrected an edge case of transaction handling in the commit_on_success decorator. Thanks to guettli for the report, and Gabriel Hurley for the initial test case.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12764 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/transaction.py')
-rw-r--r--django/db/transaction.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/django/db/transaction.py b/django/db/transaction.py
index 6cd078d94d..31d717f4d2 100644
--- a/django/db/transaction.py
+++ b/django/db/transaction.py
@@ -304,7 +304,11 @@ def commit_on_success(using=None):
raise
else:
if is_dirty(using=db):
- commit(using=db)
+ try:
+ commit(using=db)
+ except:
+ rollback(using=db)
+ raise
return res
finally:
leave_transaction_management(using=db)