File tree 1 file changed +9
-6
lines changed
debug_toolbar/panels/templates
1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -27,15 +27,18 @@ def template_source(request):
27
27
template_name = request .GET .get ("template" , template_origin_name )
28
28
29
29
final_loaders = []
30
- loaders = Engine .get_default ().template_loaders
30
+ loaders = list (Engine .get_default ().template_loaders )
31
+
32
+ while loaders :
33
+ loader = loaders .pop (0 )
31
34
32
- for loader in loaders :
33
35
if loader is not None :
34
- # When the loader has loaders associated with it,
35
- # append those loaders to the list. This occurs with
36
- # django.template.loaders.cached.Loader
36
+ # Recursively unwrap loaders until we get to loaders which do not
37
+ # themselves wrap other loaders. This occurs
38
+ # with django.template.loaders.cached.Loader and the
39
+ # django-template-partials loader (possibly among others)
37
40
if hasattr (loader , "loaders" ):
38
- final_loaders += loader .loaders
41
+ loaders . extend ( loader .loaders )
39
42
else :
40
43
final_loaders .append (loader )
41
44
You can’t perform that action at this time.
0 commit comments