summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorTim Martin <tim@asymptotic.co.uk>2014-05-12 21:52:49 +0100
committerTim Graham <timograham@gmail.com>2014-05-15 07:55:36 -0400
commit27aa85246a218b0999c7c9d227eed2afb08ed510 (patch)
treefab31ef643827c28c3e2fdb25cb7b7005eae448a /django
parent4ef10f245ada0c7d5ae8dc31eebffa63790d40fb (diff)
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.
Diffstat (limited to 'django')
-rw-r--r--django/db/backends/__init__.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py
index 0c328a50c8..dfc967e60a 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):
"""