diff options
| author | David Cramer | 2011-10-12 15:59:27 -0700 |
|---|---|---|
| committer | David Cramer | 2011-10-12 15:59:27 -0700 |
| commit | c9147364e40fd01d5fafcbdeb1c9563d2b5a4361 (patch) | |
| tree | b5ce1457417420426eaf96cc43620d67e30c8994 | |
| parent | 6bb5102f928b3f2a4de01e15596f6a658498f0ea (diff) | |
| download | django-debug-toolbar-c9147364e40fd01d5fafcbdeb1c9563d2b5a4361.tar.bz2 | |
Ensure we are actually using the new get_stack code instead of inspect.stack
| -rw-r--r-- | debug_toolbar/utils/tracking/db.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/debug_toolbar/utils/tracking/db.py b/debug_toolbar/utils/tracking/db.py index c808a7f..a40976e 100644 --- a/debug_toolbar/utils/tracking/db.py +++ b/debug_toolbar/utils/tracking/db.py @@ -10,7 +10,8 @@ from django.utils import simplejson from django.utils.encoding import force_unicode from django.utils.hashcompat import sha_constructor -from debug_toolbar.utils import ms_from_timedelta, tidy_stacktrace, get_template_info +from debug_toolbar.utils import ms_from_timedelta, tidy_stacktrace, get_template_info, \ + get_stack from debug_toolbar.utils.compat.db import connections # TODO:This should be set in the toolbar loader as a default and panels should # get a copy of the toolbar object with access to its config dictionary @@ -55,7 +56,7 @@ class NormalCursorWrapper(object): """ Wraps a cursor and logs queries. """ - + def __init__(self, cursor, db, logger): self.cursor = cursor # Instance of a BaseDatabaseWrapper subclass @@ -74,7 +75,7 @@ class NormalCursorWrapper(object): enable_stacktraces = getattr(settings, 'DEBUG_TOOLBAR_CONFIG', {}) \ .get('ENABLE_STACKTRACES', True) if enable_stacktraces: - stacktrace = tidy_stacktrace(reversed(inspect.stack())) + stacktrace = tidy_stacktrace(reversed(get_stack())) else: stacktrace = [] _params = '' @@ -128,8 +129,8 @@ class NormalCursorWrapper(object): 'iso_level': conn.isolation_level, 'encoding': conn.encoding, }) - - + + # We keep `sql` to maintain backwards compatibility self.logger.record(**params) |
