def cursor(self): """ Creates a cursor, opening a connection if necessary. """ self.validate_thread_sharing() if (self.use_debug_cursor or (self.use_debug_cursor is None and settings.DEBUG)): cursor = self.make_debug_cursor(self._cursor()) else: cursor = utils.CursorWrapper(self._cursor(), self) return cursor
def make_cursor(self, cursor): """Create a cursor without debug logging.""" return utils.CursorWrapper(cursor, self)
def non_logging_cursor(cursor): """ Prevents any queries from being logged for the duration of the deferred task """ return utils.CursorWrapper(cursor, connection)