Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #10216. Only try to gather template exception info if the excep…

…tion is a Django TemplateSyntaxError. Thanks, Alex Gaynor.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12586 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 83e52e316225650467ebbee2d86eff7bd5b566e7 1 parent dc1ad69
Joseph Kocherhans authored February 24, 2010

Showing 1 changed file with 7 additions and 4 deletions. Show diff stats Hide diff stats

  1. 11  django/views/debug.py
11  django/views/debug.py
... ...
@@ -1,15 +1,17 @@
  1
+import datetime
1 2
 import os
2 3
 import re
3 4
 import sys
4  
-import datetime
5 5
 
6 6
 from django.conf import settings
7  
-from django.template import Template, Context, TemplateDoesNotExist
  7
+from django.http import HttpResponse, HttpResponseServerError, HttpResponseNotFound
  8
+from django.template import (Template, Context, TemplateDoesNotExist,
  9
+    TemplateSyntaxError)
8 10
 from django.utils.html import escape
9 11
 from django.utils.importlib import import_module
10  
-from django.http import HttpResponse, HttpResponseServerError, HttpResponseNotFound
11 12
 from django.utils.encoding import smart_unicode, smart_str
12 13
 
  14
+
13 15
 HIDDEN_SETTINGS = re.compile('SECRET|PASSWORD|PROFANITIES_LIST')
14 16
 
15 17
 def linebreak_iter(template_source):
@@ -100,7 +102,8 @@ def get_traceback_html(self):
100 102
                     'loader': loader_name,
101 103
                     'templates': template_list,
102 104
                 })
103  
-        if settings.TEMPLATE_DEBUG and hasattr(self.exc_value, 'source'):
  105
+        if (settings.TEMPLATE_DEBUG and hasattr(self.exc_value, 'source') and
  106
+            isinstance(self.exc_value, TemplateSyntaxError)):
104 107
             self.get_template_exception_info()
105 108
 
106 109
         frames = self.get_traceback_frames()

0 notes on commit 83e52e3

Please sign in to comment.
Something went wrong with that request. Please try again.