aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cramer2011-04-13 11:11:46 -0700
committerDavid Cramer2011-04-13 11:11:46 -0700
commita00f3c050ee2a1d37d14efa6bca402df6c466051 (patch)
tree09efbb1f60e39bb58c04ec22b6012b056f88abae
parent95b1654028f74db4478da2214460ae8c363e8084 (diff)
downloaddjango-debug-toolbar-a00f3c050ee2a1d37d14efa6bca402df6c466051.tar.bz2
Ensure we are verifying that template.name is present before running a string check
-rw-r--r--debug_toolbar/panels/template.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/debug_toolbar/panels/template.py b/debug_toolbar/panels/template.py
index d9cd071..44b8b3e 100644
--- a/debug_toolbar/panels/template.py
+++ b/debug_toolbar/panels/template.py
@@ -3,8 +3,6 @@ from pprint import pformat
from django import http
from django.conf import settings
-from django.core.signals import request_started
-from django.dispatch import Signal
from django.template.context import get_standard_processors
from django.template.loader import render_to_string
from django.test.signals import template_rendered
@@ -56,7 +54,7 @@ class TemplateDebugPanel(DebugPanel):
def title(self):
num_templates = len([t for t in self.templates
- if not t['template'].name.startswith('debug_toolbar/')])
+ if not (t['template'].name and t['template'].name.startswith('debug_toolbar/'))])
return _('Templates (%(num_templates)s rendered)') % {'num_templates': num_templates}
def url(self):
@@ -78,7 +76,7 @@ class TemplateDebugPanel(DebugPanel):
# Clean up some info about templates
template = template_data.get('template', None)
# Skip templates that we are generating through the debug toolbar.
- if template.name.startswith('debug_toolbar/'):
+ if template.name and template.name.startswith('debug_toolbar/'):
continue
if template.origin and template.origin.name:
template.origin_name = template.origin.name