Ticket #10216: django-syntax-error-jinja.diff

File django-syntax-error-jinja.diff, 1.3 KB (added by Alex Gaynor, 15 years ago)
  • django/views/debug.py

    diff --git a/django/views/debug.py b/django/views/debug.py
    index 6312d01..e4e23f2 100644
    a b  
     1import datetime
    12import os
    23import re
    34import sys
    4 import datetime
    55
    66from django.conf import settings
    7 from django.template import Template, Context, TemplateDoesNotExist
     7from django.http import HttpResponse, HttpResponseServerError, HttpResponseNotFound
     8from django.template import (Template, Context, TemplateDoesNotExist,
     9    TemplateSyntaxError)
    810from django.utils.html import escape
    911from django.utils.importlib import import_module
    10 from django.http import HttpResponse, HttpResponseServerError, HttpResponseNotFound
    1112from django.utils.encoding import smart_unicode, smart_str
    1213
     14
    1315HIDDEN_SETTINGS = re.compile('SECRET|PASSWORD|PROFANITIES_LIST')
    1416
    1517def linebreak_iter(template_source):
    class ExceptionReporter:  
    100102                    'loader': loader_name,
    101103                    'templates': template_list,
    102104                })
    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)):
    104107            self.get_template_exception_info()
    105108
    106109        frames = self.get_traceback_frames()
Back to Top