Ticket #10216: 10216.diff

File 10216.diff, 1.2 KB (added by miracle2k, 16 years ago)
  • django/views/debug.py

    diff --git a/django/views/debug.py b/django/views/debug.py
    index d1e9259..f9e373b 100644
    a b import sys  
    44import datetime
    55
    66from django.conf import settings
    7 from django.template import Template, Context, TemplateDoesNotExist
     7from django.template import Template, Context, TemplateDoesNotExist, Origin
    88from django.utils.html import escape
    99from django.http import HttpResponse, HttpResponseServerError, HttpResponseNotFound
    1010from django.utils.encoding import smart_unicode, smart_str
    class ExceptionReporter:  
    7878                    'loader': loader.__module__ + '.' + loader.__name__,
    7979                    'templates': template_list,
    8080                })
    81         if settings.TEMPLATE_DEBUG and hasattr(self.exc_value, 'source'):
    82             self.get_template_exception_info()
     81        if settings.TEMPLATE_DEBUG and hasattr(self.exc_value, 'source') and \
     82           isinstance(self.exc_value.source, (list, tuple)) and \
     83           len(self.exc_value.source)==2 and isinstance(self.exc_value[0], Origin):
     84                self.get_template_exception_info()
    8385
    8486        frames = self.get_traceback_frames()
    8587
Back to Top