mirror of https://github.com/django/django.git
Used the same instance of atomic for entry and exit.
Since all state is maintained on the connection at this time and none in the atomic, it doesn't matter, but it could introduce some subtle bugs if the implementation changed in the future.
This commit is contained in:
parent
e74d2183c2
commit
0aa4c6c391
|
@ -72,7 +72,8 @@ class BaseDatabaseSchemaEditor(object):
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
self.deferred_sql = []
|
self.deferred_sql = []
|
||||||
if self.connection.features.can_rollback_ddl:
|
if self.connection.features.can_rollback_ddl:
|
||||||
atomic(self.connection.alias).__enter__()
|
self.atomic = atomic(self.connection.alias)
|
||||||
|
self.atomic.__enter__()
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def __exit__(self, exc_type, exc_value, traceback):
|
def __exit__(self, exc_type, exc_value, traceback):
|
||||||
|
@ -80,7 +81,7 @@ class BaseDatabaseSchemaEditor(object):
|
||||||
for sql in self.deferred_sql:
|
for sql in self.deferred_sql:
|
||||||
self.execute(sql)
|
self.execute(sql)
|
||||||
if self.connection.features.can_rollback_ddl:
|
if self.connection.features.can_rollback_ddl:
|
||||||
atomic(self.connection.alias).__exit__(exc_type, exc_value, traceback)
|
self.atomic.__exit__(exc_type, exc_value, traceback)
|
||||||
|
|
||||||
# Core utility functions
|
# Core utility functions
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue