From a00f3c050ee2a1d37d14efa6bca402df6c466051 Mon Sep 17 00:00:00 2001 From: David Cramer Date: Wed, 13 Apr 2011 11:11:46 -0700 Subject: Ensure we are verifying that template.name is present before running a string check --- debug_toolbar/panels/template.py | 6 ++---- 1 file 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 -- cgit v1.2.3