Django

Code

Ticket #6494: 0035-Split-off-traceback-HTML-generation.patch

File 0035-Split-off-traceback-HTML-generation.patch, 1.5 kB (added by Bastian Kleineidam <calvin@debian.org>, 1 year ago)
  • a/django/views/debug.py

    old new  
    7171    Create a technical server error response. The last three arguments are 
    7272    the values returned from sys.exc_info() and friends. 
    7373    """ 
     74    html = get_traceback_html(request, exc_type, exc_value, tb) 
     75    return HttpResponseServerError(html, mimetype='text/html') 
     76 
     77def get_traceback_html (request, exc_type, exc_value, tb): 
     78    "Return HTML code for traceback." 
    7479    template_info = None 
    7580    template_does_not_exist = False 
    7681    loader_debug_info = None 
     
    155160        'template_does_not_exist': template_does_not_exist, 
    156161        'loader_debug_info': loader_debug_info, 
    157162    }) 
    158     return HttpResponseServerError(t.render(c), mimetype='text/html'
     163    return t.render(c
    159164 
    160165def technical_404_response(request, exception): 
    161166    "Create a technical 404 error response. The exception should be the Http404."