Opened 15 years ago

Closed 15 years ago

Last modified 14 years ago

#874 closed defect (fixed)

[patch] Always serve technical_error views as text/html

Reported by: sune.kirkeby@… Owned by: Jacob
Component: Generic views Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The technical_error_view templates are nowhere near XHTML-compliant, so they should never be served with
DEFAULT_CONTENT_TYPE, instead they should explicitly specify text/html.

Index: django/views/
--- django/views/       (revision 571)
+++ django/views/       (working copy)
@@ -55,7 +55,7 @@
         'settings' : settings_dict,
-    return HttpResponseServerError(t.render(c))
+    return HttpResponseServerError(t.render(c), 'text/html')
 def technical_404_response(request, exception):
@@ -76,7 +76,7 @@
         'request_protocol' : os.environ.get("HTTPS") == "on" and "https" or "http",
         'settings' : dict([(k, getattr(settings, k)) for k in dir(settings) if k.isupper()]),
-    return HttpResponseNotFound(t.render(c))
+    return HttpResponseNotFound(t.render(c), 'text/html')
 def _get_lines_from_file(filename, lineno, context_lines):

Change History (1)

comment:1 Changed 15 years ago by Adrian Holovaty

Resolution: fixed
Status: newclosed

(In [1351]) Fixed #874 -- Changed debug views to use text/html mime-type instead of DEFAULT_CONTENT_TYPE. Thanks, Sune

Note: See TracTickets for help on using tickets.
Back to Top