summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2014-06-08 22:40:22 +0200
committerAymeric Augustin <aymeric.augustin@m4x.org>2014-06-09 21:35:17 +0200
commit127218b92bb8482fcb8b02457ed9797486ed3a22 (patch)
tree410be49d848133e4d2573d622ada8014d2d16f43
parent6b97ae352170d7be47176787056239cfbacb4803 (diff)
Simplified handling of use_debug_cursor.
Turned it from a tri-valued boolean into a regular boolean.
-rw-r--r--django/db/backends/__init__.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py
index 7c00773d42..39628e76fc 100644
--- a/django/db/backends/__init__.py
+++ b/django/db/backends/__init__.py
@@ -43,9 +43,9 @@ class BaseDatabaseWrapper(object):
# 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 @@ class BaseDatabaseWrapper(object):
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())