MCPcopy
hub / github.com/django/django / technical_500_response

Function technical_500_response

django/views/debug.py:65–79  ·  view source on GitHub ↗

Create a technical server error response. The last three arguments are the values returned from sys.exc_info() and friends.

(request, exc_type, exc_value, tb, status_code=500)

Source from the content-addressed store, hash-verified

63@csp_override({})
64@csp_report_only_override({})
65def technical_500_response(request, exc_type, exc_value, tb, status_code=500):
66 """
67 Create a technical server error response. The last three arguments are
68 the values returned from sys.exc_info() and friends.
69 """
70 reporter = get_exception_reporter_class(request)(request, exc_type, exc_value, tb)
71 preferred_type = request.get_preferred_type(["text/html", "text/plain"])
72 if preferred_type == "text/html":
73 html = reporter.get_traceback_html()
74 return HttpResponse(html, status=status_code, content_type="text/html")
75 else:
76 text = reporter.get_traceback_text()
77 return HttpResponse(
78 text, status=status_code, content_type="text/plain; charset=utf-8"
79 )
80
81
82@functools.lru_cache

Callers 15

csp_500Function · 0.90
raisesFunction · 0.90
raises500Function · 0.90
getMethod · 0.90
non_sensitive_viewFunction · 0.90
sensitive_viewFunction · 0.90
async_sensitive_viewFunction · 0.90
paranoid_viewFunction · 0.90

Calls 5

HttpResponseClass · 0.90
get_preferred_typeMethod · 0.80
get_traceback_htmlMethod · 0.45
get_traceback_textMethod · 0.45