Commit 1107e6b4 authored by Russell Keith-Magee's avatar Russell Keith-Magee
Browse files

Fixed #7751 -- Added check to allow for the fact that autocommit can be a...

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
parent 431206a2
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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"):
        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)