Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Simplified handling of use_debug_cursor.

Turned it from a tri-valued boolean into a regular boolean.
  • Loading branch information...
commit 127218b92bb8482fcb8b02457ed9797486ed3a22 1 parent 6b97ae3
@aaugustin aaugustin authored
Showing with 3 additions and 4 deletions.
  1. +3 −4 django/db/backends/__init__.py
View
7 django/db/backends/__init__.py
@@ -43,9 +43,9 @@ def __init__(self, settings_dict, alias=DEFAULT_DB_ALIAS,
# to disambiguate it from Django settings modules.
self.settings_dict = settings_dict
self.alias = alias
- # Query logging in debug mode.
- self.use_debug_cursor = None
+ # Query logging in debug mode or when explicitly enabled.
self.queries_log = deque(maxlen=self.queries_limit)
+ self.use_debug_cursor = False
# Transaction related attributes.
# Tracks if the connection is in autocommit mode. Per PEP 249, by
@@ -156,8 +156,7 @@ 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)):
+ if self.use_debug_cursor or settings.DEBUG:
cursor = self.make_debug_cursor(self._cursor())
else:
cursor = self.make_cursor(self._cursor())
Please sign in to comment.
Something went wrong with that request. Please try again.