Skip to content

Commit a23a380

Browse files
use Union instead of |
1 parent 26c1c85 commit a23a380

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

debug_toolbar/panels/history/views.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from typing import Union
2+
13
from django.http import HttpRequest, HttpResponseBadRequest, JsonResponse
24
from django.template.loader import render_to_string
35

@@ -11,13 +13,15 @@
1113
@login_not_required
1214
@require_show_toolbar
1315
@render_with_toolbar_language
14-
def history_sidebar(request: HttpRequest) -> HttpResponseBadRequest | JsonResponse:
16+
def history_sidebar(
17+
request: HttpRequest,
18+
) -> Union[HttpResponseBadRequest, JsonResponse]:
1519
"""Returns the selected debug toolbar history snapshot."""
1620
form = HistoryStoreForm(request.GET)
1721

1822
if form.is_valid():
1923
request_id: str = form.cleaned_data["request_id"]
20-
toolbar: DebugToolbar | None = DebugToolbar.fetch(request_id)
24+
toolbar: Union[DebugToolbar, None] = DebugToolbar.fetch(request_id)
2125
exclude_history = form.cleaned_data["exclude_history"]
2226
context: dict[str, dict[str, str]] = {}
2327
if toolbar is None:
@@ -43,7 +47,9 @@ def history_sidebar(request: HttpRequest) -> HttpResponseBadRequest | JsonRespon
4347
@login_not_required
4448
@require_show_toolbar
4549
@render_with_toolbar_language
46-
def history_refresh(request: HttpRequest) -> HttpResponseBadRequest | JsonResponse:
50+
def history_refresh(
51+
request: HttpRequest,
52+
) -> Union[HttpResponseBadRequest, JsonResponse]:
4753
"""Returns the refreshed list of table rows for the History Panel."""
4854
form = HistoryStoreForm(request.GET)
4955

0 commit comments

Comments
 (0)