1
0
mirror of https://github.com/django/django.git synced 2024-12-24 10:05:46 +00:00

Fixed #22873 -- Renamed use_debug_cursor to force_debug_cursor to clarify the behavior.

This commit is contained in:
areski 2014-07-26 13:06:49 +02:00 committed by Tim Graham
parent 6d5daa30cf
commit 90faa196f6
2 changed files with 5 additions and 5 deletions

View File

@ -45,7 +45,7 @@ class BaseDatabaseWrapper(object):
self.alias = alias self.alias = alias
# Query logging in debug mode or when explicitly enabled. # Query logging in debug mode or when explicitly enabled.
self.queries_log = deque(maxlen=self.queries_limit) self.queries_log = deque(maxlen=self.queries_limit)
self.use_debug_cursor = False self.force_debug_cursor = False
# Transaction related attributes. # Transaction related attributes.
# Tracks if the connection is in autocommit mode. Per PEP 249, by # Tracks if the connection is in autocommit mode. Per PEP 249, by
@ -75,7 +75,7 @@ class BaseDatabaseWrapper(object):
@property @property
def queries_logged(self): def queries_logged(self):
return self.use_debug_cursor or settings.DEBUG return self.force_debug_cursor or settings.DEBUG
@property @property
def queries(self): def queries(self):

View File

@ -507,15 +507,15 @@ class CaptureQueriesContext(object):
return self.connection.queries[self.initial_queries:self.final_queries] return self.connection.queries[self.initial_queries:self.final_queries]
def __enter__(self): def __enter__(self):
self.use_debug_cursor = self.connection.use_debug_cursor self.force_debug_cursor = self.connection.force_debug_cursor
self.connection.use_debug_cursor = True self.connection.force_debug_cursor = True
self.initial_queries = len(self.connection.queries_log) self.initial_queries = len(self.connection.queries_log)
self.final_queries = None self.final_queries = None
request_started.disconnect(reset_queries) request_started.disconnect(reset_queries)
return self return self
def __exit__(self, exc_type, exc_value, traceback): 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) request_started.connect(reset_queries)
if exc_type is not None: if exc_type is not None:
return return