From 27aa85246a218b0999c7c9d227eed2afb08ed510 Mon Sep 17 00:00:00 2001 From: Tim Martin Date: Mon, 12 May 2014 21:52:49 +0100 Subject: [PATCH] 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. --- django/db/backends/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py index 0c328a50c8f..dfc967e60ad 100644 --- a/django/db/backends/__init__.py +++ b/django/db/backends/__init__.py @@ -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): """