Made transaction.managed a no-op and deprecated it.

enter_transaction_management() was nearly always followed by managed().

In three places it wasn't, but they will all be refactored eventually.
The "forced" keyword argument avoids introducing behavior changes until
then.

This is mostly backwards-compatible, except, of course, for managed
itself. There's a minor difference in _enter_transaction_management:
the top self.transaction_state now contains the new 'managed' state
rather than the previous one. Django doesn't access
self.transaction_state in _enter_transaction_management.
This commit is contained in:
Aymeric Augustin 2013-03-02 20:25:25 +01:00
parent 9cec689e6a
commit 7aacde84f2
14 changed files with 22 additions and 64 deletions

View file

@ -576,7 +576,6 @@ class DatabaseConnectionHandlingTests(TransactionTestCase):
# Make sure there is an open connection
connection.cursor()
connection.enter_transaction_management()
connection.managed(True)
signals.request_finished.send(sender=response._handler_class)
self.assertEqual(len(connection.transaction_state), 0)
@ -585,7 +584,6 @@ class DatabaseConnectionHandlingTests(TransactionTestCase):
connection.settings_dict['CONN_MAX_AGE'] = 0
connection.enter_transaction_management()
connection.managed(True)
connection.set_dirty()
# Test that the rollback doesn't succeed (for example network failure
# could cause this).