File tree Expand file tree Collapse file tree 2 files changed +13
-14
lines changed Expand file tree Collapse file tree 2 files changed +13
-14
lines changed Original file line number Diff line number Diff line change 11
11
from debug_toolbar .panels import Panel
12
12
from debug_toolbar .panels .history import views
13
13
from debug_toolbar .panels .history .forms import HistoryStoreForm
14
- from debug_toolbar .toolbar import get_observe_request
15
14
16
15
17
16
class HistoryPanel (Panel ):
@@ -23,7 +22,7 @@ class HistoryPanel(Panel):
23
22
24
23
def get_headers (self , request ):
25
24
headers = super ().get_headers (request )
26
- observe_request = get_observe_request ()
25
+ observe_request = self . toolbar . get_observe_request ()
27
26
store_id = getattr (self .toolbar , "store_id" )
28
27
if store_id and observe_request (request ):
29
28
headers ["DJDT-STORE-ID" ] = store_id
Original file line number Diff line number Diff line change @@ -156,20 +156,20 @@ def is_toolbar_request(cls, request):
156
156
return False
157
157
return resolver_match .namespaces and resolver_match .namespaces [- 1 ] == app_name
158
158
159
+ @staticmethod
160
+ @lru_cache
161
+ def get_observe_request ():
162
+ # If OBSERVE_REQUEST_CALLBACK is a string, which is the recommended
163
+ # setup, resolve it to the corresponding callable.
164
+ func_or_path = dt_settings .get_config ()["OBSERVE_REQUEST_CALLBACK" ]
165
+ if isinstance (func_or_path , str ):
166
+ return import_string (func_or_path )
167
+ else :
168
+ return func_or_path
169
+
159
170
160
171
def observe_request (request ):
161
172
"""
162
- Default function to determine whether to update the toolbar from a client side request
173
+ Determine whether to update the toolbar from a client side request.
163
174
"""
164
175
return not DebugToolbar .is_toolbar_request (request )
165
-
166
-
167
- @lru_cache ()
168
- def get_observe_request ():
169
- # If OBSERVE_REQUEST_CALLBACK is a string, which is the recommended
170
- # setup, resolve it to the corresponding callable.
171
- func_or_path = dt_settings .get_config ()["OBSERVE_REQUEST_CALLBACK" ]
172
- if isinstance (func_or_path , str ):
173
- return import_string (func_or_path )
174
- else :
175
- return func_or_path
You can’t perform that action at this time.
0 commit comments