mirror of
https://github.com/django/django.git
synced 2025-07-06 10:49:17 +00:00
[1.2.X] Fixed #10215 -- Ensured that there is parity between enter and leave transaction calls in loaddata when commit=False. The test case for this is the fixtures_regress unittests under MyISAM, which were failing previous to this fix. Thanks to MockSoul for the report.
Backport of r13978 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@13979 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
1429a3dbba
commit
8266925684
@ -118,6 +118,7 @@ class Command(BaseCommand):
|
|||||||
self.stderr.write(
|
self.stderr.write(
|
||||||
self.style.ERROR("Problem installing fixture '%s': %s is not a known serialization format.\n" %
|
self.style.ERROR("Problem installing fixture '%s': %s is not a known serialization format.\n" %
|
||||||
(fixture_name, format)))
|
(fixture_name, format)))
|
||||||
|
if commit:
|
||||||
transaction.rollback(using=using)
|
transaction.rollback(using=using)
|
||||||
transaction.leave_transaction_management(using=using)
|
transaction.leave_transaction_management(using=using)
|
||||||
return
|
return
|
||||||
@ -152,6 +153,7 @@ class Command(BaseCommand):
|
|||||||
fixture.close()
|
fixture.close()
|
||||||
self.stderr.write(self.style.ERROR("Multiple fixtures named '%s' in %s. Aborting.\n" %
|
self.stderr.write(self.style.ERROR("Multiple fixtures named '%s' in %s. Aborting.\n" %
|
||||||
(fixture_name, humanize(fixture_dir))))
|
(fixture_name, humanize(fixture_dir))))
|
||||||
|
if commit:
|
||||||
transaction.rollback(using=using)
|
transaction.rollback(using=using)
|
||||||
transaction.leave_transaction_management(using=using)
|
transaction.leave_transaction_management(using=using)
|
||||||
return
|
return
|
||||||
@ -178,6 +180,7 @@ class Command(BaseCommand):
|
|||||||
except Exception:
|
except Exception:
|
||||||
import traceback
|
import traceback
|
||||||
fixture.close()
|
fixture.close()
|
||||||
|
if commit:
|
||||||
transaction.rollback(using=using)
|
transaction.rollback(using=using)
|
||||||
transaction.leave_transaction_management(using=using)
|
transaction.leave_transaction_management(using=using)
|
||||||
if show_traceback:
|
if show_traceback:
|
||||||
@ -196,6 +199,7 @@ class Command(BaseCommand):
|
|||||||
self.stderr.write(
|
self.stderr.write(
|
||||||
self.style.ERROR("No fixture data found for '%s'. (File format may be invalid.)\n" %
|
self.style.ERROR("No fixture data found for '%s'. (File format may be invalid.)\n" %
|
||||||
(fixture_name)))
|
(fixture_name)))
|
||||||
|
if commit:
|
||||||
transaction.rollback(using=using)
|
transaction.rollback(using=using)
|
||||||
transaction.leave_transaction_management(using=using)
|
transaction.leave_transaction_management(using=using)
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user