Commit 4926acf2 authored by Giorgos Korfiatis's avatar Giorgos Korfiatis
Browse files

Rollback, even if transaction is not dirty

This is a temporary bug fix for
https://code.djangoproject.com/ticket/9964 .
Django prior to 1.3 does not set a transaction
dirty when the DB throws an exception, and thus
does not trigger rollback, resulting in a
dangling aborted DB transaction.

Since 1.3, django sets a transaction dirty on
attempting any query. This covers the above case,
too.
parent c447939f
......@@ -110,7 +110,14 @@ class TransactionHandler(object):
trigger_postprocess = False
try:
if value is not None: # exception
if transaction.is_dirty(using=db):
if transaction.is_dirty(using=db) or True:
# Rollback, even if is not dirty.
# This is a temporary bug fix for
# https://code.djangoproject.com/ticket/9964 .
# Django prior to 1.3 does not set a transaction
# dirty when the DB throws an exception, and thus
# does not trigger rollback, resulting in a
# dangling aborted DB transaction.
transaction.rollback(using=db)
else:
if transaction.is_dirty(using=db):
......
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