From 90faa196f67863370a4682ecfd053e189cd46705 Mon Sep 17 00:00:00 2001 From: areski Date: Sat, 26 Jul 2014 13:06:49 +0200 Subject: [PATCH] Fixed #22873 -- Renamed use_debug_cursor to force_debug_cursor to clarify the behavior. --- django/db/backends/__init__.py | 4 ++-- django/test/utils.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py index d3651cda21..9e223c9cbb 100644 --- a/django/db/backends/__init__.py +++ b/django/db/backends/__init__.py @@ -45,7 +45,7 @@ class BaseDatabaseWrapper(object): self.alias = alias # Query logging in debug mode or when explicitly enabled. self.queries_log = deque(maxlen=self.queries_limit) - self.use_debug_cursor = False + self.force_debug_cursor = False # Transaction related attributes. # Tracks if the connection is in autocommit mode. Per PEP 249, by @@ -75,7 +75,7 @@ class BaseDatabaseWrapper(object): @property def queries_logged(self): - return self.use_debug_cursor or settings.DEBUG + return self.force_debug_cursor or settings.DEBUG @property def queries(self): diff --git a/django/test/utils.py b/django/test/utils.py index 9a0d7a494c..4c5c910be0 100644 --- a/django/test/utils.py +++ b/django/test/utils.py @@ -507,15 +507,15 @@ class CaptureQueriesContext(object): return self.connection.queries[self.initial_queries:self.final_queries] def __enter__(self): - self.use_debug_cursor = self.connection.use_debug_cursor - self.connection.use_debug_cursor = True + self.force_debug_cursor = self.connection.force_debug_cursor + self.connection.force_debug_cursor = True self.initial_queries = len(self.connection.queries_log) self.final_queries = None request_started.disconnect(reset_queries) return self def __exit__(self, exc_type, exc_value, traceback): - self.connection.use_debug_cursor = self.use_debug_cursor + self.connection.force_debug_cursor = self.force_debug_cursor request_started.connect(reset_queries) if exc_type is not None: return