Skip to content

Commit e272b51

Browse files
committed
Don't ignore templates without an origin
We're running Django 1.7 with django-jinja. For whatever reasons, the template origin isn't set, and the panel shows no template context whatsoever. Upon investigation, I discovered that the template rendered signal is indeed fired, but the template is skipped as no origin is set. I deny any understanding of the existing code. I do not know why we skip templates without an origin. But without this change, we aren't getting a template context in the panel, and with it, we are. So at first sight, it looks like it's safe to do. But somebody more qualified than me has to be the judge on that. Furthermore, this code marks the 'No origin' string as translatable.
1 parent 5a9bd46 commit e272b51

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

debug_toolbar/panels/templates/panel.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,10 @@ def process_response(self, request, response):
201201
info = {}
202202
# Clean up some info about templates
203203
template = template_data.get('template', None)
204-
if not hasattr(template, 'origin'):
205-
continue
206-
if template.origin and template.origin.name:
204+
if hasattr(template, 'origin') and template.origin and template.origin.name:
207205
template.origin_name = template.origin.name
208206
else:
209-
template.origin_name = 'No origin'
207+
template.origin_name = _('No origin')
210208
info['template'] = template
211209
# Clean up context for better readability
212210
if self.toolbar.config['SHOW_TEMPLATE_CONTEXT']:

0 commit comments

Comments
 (0)