From 1107e6b47978cef0a511ed2ed247921d19d36803 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Thu, 17 Jul 2008 13:24:05 +0000 Subject: [PATCH] Fixed #7751 -- Added check to allow for the fact that autocommit can be a property, rather than a function on certain database backends. Thanks to Leo Soto for the fix. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7940 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/test/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/django/test/utils.py b/django/test/utils.py index b1c528873c..41de932964 100644 --- a/django/test/utils.py +++ b/django/test/utils.py @@ -74,7 +74,10 @@ def teardown_test_environment(): def _set_autocommit(connection): "Make sure a connection is in autocommit mode." if hasattr(connection.connection, "autocommit"): - connection.connection.autocommit(True) + if callable(connection.connection.autocommit): + connection.connection.autocommit(True) + else: + connection.connection.autocommit = True elif hasattr(connection.connection, "set_isolation_level"): connection.connection.set_isolation_level(0)