Ticket #4903: debug_py_cgitb_fallback.diff

File debug_py_cgitb_fallback.diff, 1.1 KB (added by Thomas Güttler <hv@…>, 17 years ago)
  • django/views/debug.py

     
    8787                'loader': loader.__module__ + '.' + loader.__name__,
    8888                'templates': template_list,
    8989            })
     90    tborig=tb
    9091    if settings.TEMPLATE_DEBUG and hasattr(exc_value, 'source'):
    9192        exc_type, exc_value, tb, template_info = get_template_exception_info(exc_type, exc_value, tb)
    9293    frames = []
     
    138139        'template_does_not_exist': template_does_not_exist,
    139140        'loader_debug_info': loader_debug_info,
    140141    })
    141     return HttpResponseServerError(t.render(c), mimetype='text/html')
     142    try:
     143        return HttpResponseServerError(t.render(c), mimetype='text/html')
     144    except:
     145        response=HttpResponseServerError(mimetype='text/html')
     146        import cgitb
     147        cgitb.Hook(file=response).handle((exc_type, exc_value, tborig))
     148        return response
    142149
    143150def technical_404_response(request, exception):
    144151    "Create a technical 404 error response. The exception should be the Http404."
Back to Top