Skip to content

Commit 03fd1cc

Browse files
committed
Remove HIDE_DJANGO_SQL configuration option.
It was badly named and HIDE_IN_STACKTRACES provides a more general solution. The ability to show code in django.contrib but not in django doesn't seem particularly useful. Fix django-commons#474.
1 parent 66e03a5 commit 03fd1cc

File tree

4 files changed

+13
-21
lines changed

4 files changed

+13
-21
lines changed

debug_toolbar/settings.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@
2424
# Panel options
2525
'EXTRA_SIGNALS': [],
2626
'ENABLE_STACKTRACES': True,
27-
'HIDE_DJANGO_SQL': True,
2827
'HIDE_IN_STACKTRACES': (
2928
'socketserver' if six.PY3 else 'SocketServer',
3029
'threading',
3130
'wsgiref',
3231
'debug_toolbar',
32+
'django',
3333
),
3434
'INTERCEPT_REDIRECTS': False,
3535
'SHOW_TEMPLATE_CONTEXT': True,
@@ -50,11 +50,16 @@
5050
"%r was renamed to %r. Update your DEBUG_TOOLBAR_CONFIG "
5151
"setting." % (old_name, new_name), DeprecationWarning)
5252
USER_CONFIG[new_name] = USER_CONFIG.pop(old_name)
53+
if 'HIDE_DJANGO_SQL' in USER_CONFIG:
54+
warnings.warn(
55+
"HIDE_DJANGO_SQL was removed. Update your "
56+
"DEBUG_TOOLBAR_CONFIG setting.", DeprecationWarning)
57+
USER_CONFIG.pop('HIDE_DJANGO_SQL')
5358
if 'TAG' in USER_CONFIG:
54-
warnings.warn(
59+
warnings.warn(
5560
"TAG was replaced by INSERT_BEFORE. Update your "
5661
"DEBUG_TOOLBAR_CONFIG setting.", DeprecationWarning)
57-
USER_CONFIG['INSERT_BEFORE'] = '</%s>' % USER_CONFIG.pop('TAG')
62+
USER_CONFIG['INSERT_BEFORE'] = '</%s>' % USER_CONFIG.pop('TAG')
5863
CONFIG.update(USER_CONFIG)
5964

6065

debug_toolbar/utils.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,7 @@ def tidy_stacktrace(stack):
5454
"""
5555
trace = []
5656
for frame, path, line_no, func_name, text in (f[:5] for f in stack):
57-
s_path = os.path.realpath(path)
58-
# Support hiding of frames -- used in various utilities that provide
59-
# inspection.
60-
if CONFIG['HIDE_DJANGO_SQL'] and django_path in s_path and not 'django/contrib' in s_path:
61-
continue
62-
if omit_path(s_path):
57+
if omit_path(os.path.realpath(path)):
6358
continue
6459
text = (''.join(force_text(t) for t in text)).strip() if text else ''
6560
trace.append((path, line_no, func_name, text))

docs/configuration.rst

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -117,20 +117,11 @@ Panel options
117117
calls. Enabling stacktraces can increase the CPU time used when executing
118118
queries.
119119

120-
* ``HIDE_DJANGO_SQL``
121-
122-
Default: ``True``
123-
124-
Panels: cache, SQL
125-
126-
If set to ``True`` then code in Django itself won't be shown in
127-
stacktraces.
128-
129120
* ``HIDE_IN_STACKTRACES``
130121

131-
Default: ``('socketserver', 'threading', 'wsgiref', 'debug_toolbar')``. The
132-
first value is ``socketserver`` on Python 3 and ``SocketServer`` on Python
133-
2.
122+
Default: ``('socketserver', 'threading', 'wsgiref', 'debug_toolbar',
123+
'django')``. The first value is ``socketserver`` on Python 3 and
124+
``SocketServer`` on Python 2.
134125

135126
Panels: cache, SQL
136127

tests/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def update_toolbar_config(**kwargs):
1515
dt_settings.CONFIG.update(kwargs['value'] or {})
1616
# This doesn't account for deprecated configuration options.
1717

18+
1819
@receiver(setting_changed)
1920
def update_toolbar_panels(**kwargs):
2021
if kwargs['setting'] == 'DEBUG_TOOLBAR_PANELS':

0 commit comments

Comments
 (0)