Ticket #15025: 15025-technical-500-response-r15153.diff
File 15025-technical-500-response-r15153.diff, 2.0 KB (added by , 14 years ago) |
---|
-
django/views/debug.py
8 8 from django.http import HttpResponse, HttpResponseServerError, HttpResponseNotFound 9 9 from django.template import (Template, Context, TemplateDoesNotExist, 10 10 TemplateSyntaxError) 11 from django.template.defaultfilters import force_escape, pprint 11 12 from django.utils.html import escape 12 13 from django.utils.importlib import import_module 13 14 from django.utils.encoding import smart_unicode, smart_str 14 15 15 16 16 HIDDEN_SETTINGS = re.compile('SECRET|PASSWORD|PROFANITIES_LIST|SIGNATURE') 17 17 18 18 def linebreak_iter(template_source): … … 109 109 self.get_template_exception_info() 110 110 111 111 frames = self.get_traceback_frames() 112 for i, frame in enumerate(frames): 113 frame['vars'] = [(k, force_escape(pprint(v))) for k, v in frame['vars']] 114 frames[i] = frame 112 115 113 116 unicode_hint = '' 114 117 if issubclass(self.exc_type, UnicodeError): … … 547 550 {% for var in frame.vars|dictsort:"0" %} 548 551 <tr> 549 552 <td>{{ var.0|force_escape }}</td> 550 <td class="code"><pre>{{ var.1 |pprint|force_escape}}</pre></td>553 <td class="code"><pre>{{ var.1 }}</pre></td> 551 554 </tr> 552 555 {% endfor %} 553 556 </tbody> -
tests/regressiontests/views/views.py
36 36 form_class=SlugChangingArticleForm) 37 37 38 38 def raises(request): 39 # Make sure that a callable that raises an exception in the stack frame's 40 # local vars won't hijack the technical 500 response. See: 41 # http://code.djangoproject.com/ticket/15025 42 def callable(): 43 raise Exception 39 44 try: 40 45 raise Exception 41 46 except Exception: