Author: aaugustin Date: 2012-01-12 13:55:19 -0800 (Thu, 12 Jan 2012) New Revision: 17368
Modified: django/trunk/django/db/backends/util.py django/trunk/tests/regressiontests/transactions_regress/tests.py Log: Fixed #6669 -- Ensured database connections are marked as dirty by CursorDebugWrapper.execute/executemany. Refs #9964. Thanks james at 10gic net for the report and Claude Paroz for the patch. Modified: django/trunk/django/db/backends/util.py =================================================================== --- django/trunk/django/db/backends/util.py 2012-01-11 10:19:05 UTC (rev 17367) +++ django/trunk/django/db/backends/util.py 2012-01-12 21:55:19 UTC (rev 17368) @@ -16,9 +16,12 @@ self.cursor = cursor self.db = db - def __getattr__(self, attr): + def set_dirty(self): if self.db.is_managed(): self.db.set_dirty() + + def __getattr__(self, attr): + self.set_dirty() if attr in self.__dict__: return self.__dict__[attr] else: @@ -31,6 +34,7 @@ class CursorDebugWrapper(CursorWrapper): def execute(self, sql, params=()): + self.set_dirty() start = time() try: return self.cursor.execute(sql, params) @@ -47,6 +51,7 @@ ) def executemany(self, sql, param_list): + self.set_dirty() start = time() try: return self.cursor.executemany(sql, param_list) Modified: django/trunk/tests/regressiontests/transactions_regress/tests.py =================================================================== --- django/trunk/tests/regressiontests/transactions_regress/tests.py 2012-01-11 10:19:05 UTC (rev 17367) +++ django/trunk/tests/regressiontests/transactions_regress/tests.py 2012-01-12 21:55:19 UTC (rev 17368) @@ -4,6 +4,7 @@ from django.db import connection, transaction from django.db.transaction import commit_on_success, commit_manually, TransactionManagementError from django.test import TransactionTestCase, skipUnlessDBFeature +from django.test.utils import override_settings from django.utils.unittest import skipIf from .models import Mod, M2mA, M2mB @@ -166,7 +167,14 @@ except: self.fail("A transaction consisting of a failed operation was not closed.") + @override_settings(DEBUG=True) + def test_failing_query_transaction_closed_debug(self): + """ + Regression for #6669. Same test as above, with DEBUG=True. + """ + self.test_failing_query_transaction_closed() + class TestManyToManyAddTransaction(TransactionTestCase): def test_manyrelated_add_commit(self): "Test for https://code.djangoproject.com/ticket/16818" -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.