Commit 27aa8524 authored by Tim Martin's avatar Tim Martin Committed by Tim Graham
Browse files

Fixed #20897 -- Added make_cursor() for consistent cursor creation

In django.db.backends.BaseDatabaseWrapper, pulled the creation of
cursors in the non-debug case into a separate method, in order to
make behavior more consistent when overriding the cursor creation
in derived classes.
parent 4ef10f24
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -158,7 +158,7 @@ class BaseDatabaseWrapper(object):
                (self.use_debug_cursor is None and settings.DEBUG)):
            cursor = self.make_debug_cursor(self._cursor())
        else:
            cursor = utils.CursorWrapper(self._cursor(), self)
            cursor = self.make_cursor(self._cursor())
        return cursor

    def commit(self):
@@ -433,6 +433,12 @@ class BaseDatabaseWrapper(object):
        """
        return utils.CursorDebugWrapper(cursor, self)

    def make_cursor(self, cursor):
        """
        Creates a cursor without debug logging.
        """
        return utils.CursorWrapper(cursor, self)

    @contextmanager
    def temporary_connection(self):
        """