Fixed #102 -- Now using text/plain mimetype for exceptions displayed in the browser, so angle brackets are no longer an issue

git-svn-id: http://code.djangoproject.com/svn/django/trunk@241 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-07-20 06:13:06 +00:00
parent 2012f7df63
commit e215ed3609
2 changed files with 4 additions and 4 deletions

View File

@ -258,9 +258,9 @@ class ModPythonHandler:
Returns an HttpResponse that displays a TECHNICAL error message for a Returns an HttpResponse that displays a TECHNICAL error message for a
fundamental database or coding error. fundamental database or coding error.
""" """
error_string = "<pre>There's been an error:\n\n%s</pre>" % self._get_traceback() error_string = "There's been an error:\n\n%s" % self._get_traceback()
responseClass = is404 and httpwrappers.HttpResponseNotFound or httpwrappers.HttpResponseServerError responseClass = is404 and httpwrappers.HttpResponseNotFound or httpwrappers.HttpResponseServerError
return responseClass(error_string) return responseClass(error_string, mimetype='text/plain')
def _get_traceback(self): def _get_traceback(self):
"Helper function to return the traceback as a string" "Helper function to return the traceback as a string"

View File

@ -232,9 +232,9 @@ class WSGIHandler:
Returns an HttpResponse that displays a TECHNICAL error message for a Returns an HttpResponse that displays a TECHNICAL error message for a
fundamental database or coding error. fundamental database or coding error.
""" """
error_string = "<pre>There's been an error:\n\n%s</pre>" % self._get_traceback() error_string = "There's been an error:\n\n%s" % self._get_traceback()
responseClass = is404 and httpwrappers.HttpResponseNotFound or httpwrappers.HttpResponseServerError responseClass = is404 and httpwrappers.HttpResponseNotFound or httpwrappers.HttpResponseServerError
return responseClass(error_string) return responseClass(error_string, mimetype='text/plain')
def _get_traceback(self): def _get_traceback(self):
"Helper function to return the traceback as a string" "Helper function to return the traceback as a string"