mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #19861 -- Transaction ._dirty flag improvement
There were a couple of errors in ._dirty flag handling: * It started as None, but was never reset to None. * The _dirty flag was sometimes used to indicate if the connection was inside transaction management, but this was not done consistently. This also meant the flag had three separate values. * The None value had a special meaning, causing for example inability to commit() on new connection unless enter/leave tx management was done. * The _dirty was tracking "connection in transaction" state, but only in managed transactions. * Some tests never reset the transaction state of the used connection. * And some additional less important changes. This commit has some potential for regressions, but as the above list shows, the current situation isn't perfect either.
This commit is contained in:
parent
2108941677
commit
50328f0a61
12 changed files with 161 additions and 69 deletions
|
@ -23,11 +23,13 @@ class DeleteLockingTest(TransactionTestCase):
|
|||
# Put both DB connections into managed transaction mode
|
||||
transaction.enter_transaction_management()
|
||||
transaction.managed(True)
|
||||
self.conn2._enter_transaction_management(True)
|
||||
self.conn2.enter_transaction_management()
|
||||
self.conn2.managed(True)
|
||||
|
||||
def tearDown(self):
|
||||
# Close down the second connection.
|
||||
transaction.leave_transaction_management()
|
||||
self.conn2.abort()
|
||||
self.conn2.close()
|
||||
|
||||
@skipUnlessDBFeature('test_db_allows_multiple_connections')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue