Skip to content

Commit 9a81958

Browse files
authored
Make Panels non async by default (#1990)
* make panel non async by default
1 parent 940fd22 commit 9a81958

13 files changed

+18
-8
lines changed

debug_toolbar/panels/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Panel:
1010
Base class for panels.
1111
"""
1212

13-
is_async = True
13+
is_async = False
1414

1515
def __init__(self, toolbar, get_response):
1616
self.toolbar = toolbar

debug_toolbar/panels/alerts.py

+2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ class AlertsPanel(Panel):
7676

7777
title = _("Alerts")
7878

79+
is_async = True
80+
7981
template = "debug_toolbar/panels/alerts.html"
8082

8183
def __init__(self, *args, **kwargs):

debug_toolbar/panels/cache.py

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ class CachePanel(Panel):
5858

5959
template = "debug_toolbar/panels/cache.html"
6060

61+
is_async = True
62+
6163
_context_locals = Local()
6264

6365
def __init__(self, *args, **kwargs):

debug_toolbar/panels/headers.py

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ class HeadersPanel(Panel):
3030

3131
title = _("Headers")
3232

33+
is_async = True
34+
3335
template = "debug_toolbar/panels/headers.html"
3436

3537
def process_request(self, request):

debug_toolbar/panels/redirects.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ class RedirectsPanel(Panel):
1111
Panel that intercepts redirects and displays a page with debug info.
1212
"""
1313

14-
is_async = True
1514
has_content = False
1615

16+
is_async = True
17+
1718
nav_title = _("Intercept redirects")
1819

1920
def _process_response(self, response):

debug_toolbar/panels/request.py

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ class RequestPanel(Panel):
1515

1616
title = _("Request")
1717

18-
is_async = False
19-
2018
@property
2119
def nav_subtitle(self):
2220
"""

debug_toolbar/panels/settings.py

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ class SettingsPanel(Panel):
1414

1515
template = "debug_toolbar/panels/settings.html"
1616

17+
is_async = True
18+
1719
nav_title = _("Settings")
1820

1921
def title(self):

debug_toolbar/panels/signals.py

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
class SignalsPanel(Panel):
2929
template = "debug_toolbar/panels/signals.html"
3030

31+
is_async = True
32+
3133
SIGNALS = {
3234
"request_started": request_started,
3335
"request_finished": request_finished,

debug_toolbar/panels/staticfiles.py

-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ class StaticFilesPanel(panels.Panel):
7373
A panel to display the found staticfiles.
7474
"""
7575

76-
is_async = False
7776
name = "Static files"
7877
template = "debug_toolbar/panels/staticfiles.html"
7978

debug_toolbar/panels/templates/panel.py

+2
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ class TemplatesPanel(Panel):
6868
A panel that lists all templates used during processing of a response.
6969
"""
7070

71+
is_async = True
72+
7173
def __init__(self, *args, **kwargs):
7274
super().__init__(*args, **kwargs)
7375
self.templates = []

debug_toolbar/panels/timer.py

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ class TimerPanel(Panel):
1717
Panel that displays the time a response took in milliseconds.
1818
"""
1919

20-
is_async = False
21-
2220
def nav_subtitle(self):
2321
stats = self.get_stats()
2422
if hasattr(self, "_start_rusage"):

debug_toolbar/panels/versions.py

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class VersionsPanel(Panel):
1212
Shows versions of Python, Django, and installed apps if possible.
1313
"""
1414

15+
is_async = True
16+
1517
@property
1618
def nav_subtitle(self):
1719
return "Django %s" % django.get_version()

docs/architecture.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Problematic Parts
8282
- Support for async and multi-threading: ``debug_toolbar.middleware.DebugToolbarMiddleware``
8383
is now async compatible and can process async requests. However certain
8484
panels such as ``SQLPanel``, ``TimerPanel``, ``StaticFilesPanel``,
85-
``RequestPanel`` and ``ProfilingPanel`` aren't fully
85+
``RequestPanel``, ``HistoryPanel`` and ``ProfilingPanel`` aren't fully
8686
compatible and currently being worked on. For now, these panels
8787
are disabled by default when running in async environment.
8888
follow the progress of this issue in `Async compatible toolbar project <https://github.com/orgs/jazzband/projects/9>`_.

0 commit comments

Comments
 (0)