0
0
mirror of https://github.com/django/django.git synced 2024-12-01 15:42:04 +01:00

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.
This commit is contained in:
Tim Martin 2014-05-12 21:52:49 +01:00 committed by Tim Graham
parent 4ef10f245a
commit 27aa85246a

View File

@ -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):
"""