Ticket #6537: 6537.diff
File 6537.diff, 2.8 KB (added by , 17 years ago) |
---|
-
django/views/debug.py
2 2 import re 3 3 import sys 4 4 import datetime 5 import traceback 5 6 6 7 from django.conf import settings 7 8 from django.template import Template, Context, TemplateDoesNotExist … … 104 105 }) 105 106 if settings.TEMPLATE_DEBUG and hasattr(exc_value, 'source'): 106 107 exc_type, exc_value, tb, template_info = get_template_exception_info(exc_type, exc_value, tb) 108 original_exc_info=getattr(exc_value, 'original_exc_info', None) 109 if original_exc_info: 110 original_exc_info=''.join([smart_unicode(line, errors='replace') for line in traceback.format_exception(*original_exc_info)]) 111 107 112 frames = [] 108 113 while tb is not None: 109 114 # support for __traceback_hide__ which is used by a few libraries … … 165 170 'template_info': template_info, 166 171 'template_does_not_exist': template_does_not_exist, 167 172 'loader_debug_info': loader_debug_info, 173 'original_exc_info': original_exc_info, 168 174 }) 169 175 return t.render(c) 170 176 … … 379 385 <th>Exception Location:</th> 380 386 <td>{{ lastframe.filename|escape }} in {{ lastframe.function|escape }}, line {{ lastframe.lineno }}</td> 381 387 </tr> 388 {% if original_exc_info %} 382 389 <tr> 390 <th>Original Exception:</th> 391 <td><pre>{{ original_exc_info|escape }}</pre></td> 392 </tr> 393 {% endif %} 394 <tr> 383 395 <th>Python Executable:</th> 384 396 <td>{{ sys_executable|escape }}</td> 385 397 </tr> -
django/core/urlresolvers.py
252 256 except Exception, e: 253 257 # Either an invalid urlconf_name, such as "foo.bar.", or some 254 258 # kind of problem during the actual import. 255 raise ImproperlyConfigured, "Error while importing URLconf %r: %s" % (self.urlconf_name, e) 259 import sys 260 raise ImproperlyConfigured("Error while importing URLconf %r: %s" % (self.urlconf_name, e), original_exc_info=sys.exc_info()) 256 261 return self._urlconf_module 257 262 urlconf_module = property(_get_urlconf_module) 258 263 -
django/core/exceptions.py
26 26 27 27 class ImproperlyConfigured(Exception): 28 28 "Django is somehow improperly configured" 29 pass 29 def __init__(self, msg, original_exc_info=None): 30 Exception.__init__(self, msg) 31 self.original_exc_info=original_exc_info