Skip to content

Commit

Permalink
Fixed #20897 -- Added make_cursor() for consistent cursor creation
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
timmartin authored and timgraham committed May 15, 2014
1 parent 4ef10f2 commit 27aa852
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion django/db/backends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def cursor(self):
(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):
Expand Down Expand Up @@ -433,6 +433,12 @@ def make_debug_cursor(self, cursor):
"""
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):
"""
Expand Down

0 comments on commit 27aa852

Please sign in to comment.