From 6dc6be9c248cfed2778ab2398b5d5e249725502f Mon Sep 17 00:00:00 2001 From: Thiago Bellini Ribeiro Date: Wed, 24 Jul 2024 18:04:15 -0300 Subject: [PATCH] fix: Fix debug toolbar upgrade issue (#600) --- strawberry_django/middlewares/debug_toolbar.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/strawberry_django/middlewares/debug_toolbar.py b/strawberry_django/middlewares/debug_toolbar.py index 60742aef..50555f07 100644 --- a/strawberry_django/middlewares/debug_toolbar.py +++ b/strawberry_django/middlewares/debug_toolbar.py @@ -8,10 +8,10 @@ from typing import Optional from asgiref.sync import iscoroutinefunction, markcoroutinefunction, sync_to_async -from debug_toolbar.middleware import _HTML_TYPES, get_show_toolbar # noqa: PLC2701 from debug_toolbar.middleware import ( DebugToolbarMiddleware as _DebugToolbarMiddleware, ) +from debug_toolbar.middleware import get_show_toolbar from debug_toolbar.panels.sql.panel import SQLPanel from debug_toolbar.panels.templates import TemplatesPanel from debug_toolbar.toolbar import DebugToolbar @@ -23,6 +23,8 @@ from django.utils.encoding import force_str from strawberry.django.views import BaseView +_HTML_TYPES = {"text/html", "application/xhtml+xml"} + _store_cache = weakref.WeakKeyDictionary() _debug_toolbar_map: "weakref.WeakKeyDictionary[HttpRequest, DebugToolbar]" = ( weakref.WeakKeyDictionary()