Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added DEBUG_PLAINTEXT_AJAX_ERROR_MESSAGES setting to customize error display #8

Closed
wants to merge 1 commit into from

3 participants

David Hughes Aymeric Augustin Adrian Holovaty
David Hughes

The plaintext error responses for AJAX requests in 1.4 drop a lot of the stack trace context that was included in the HTML responses pre-1.4. Tools like the network response 'Preview' viewer in Chrome make it easy to navigate the HTML response to drill down into the richer context it provides. This patch maintains the 1.4 default but enables the response to be configured to use the original behavior.

Aymeric Augustin
Owner

Please be aware that pull requests won't be merged without a corresponding ticket in Trac (specifically, we need an excellent reason to add yet another setting).

Aymeric Augustin
Owner

Thanks :) Sorry, we still need to figure out some bits of our ticket management processes after the move to GitHub.

Adrian Holovaty
Collaborator

I'm closing this particular pull request, as Dave and I have discussed on Trac that a different approach would be better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 1 deletion.
  1. +3 −1 django/views/debug.py
4 django/views/debug.py
View
@@ -59,7 +59,9 @@ def technical_500_response(request, exc_type, exc_value, tb):
the values returned from sys.exc_info() and friends.
"""
reporter = ExceptionReporter(request, exc_type, exc_value, tb)
- if request.is_ajax():
+
+ plaintext = request.is_ajax() and getattr(settings, 'DEBUG_PLAINTEXT_AJAX_ERROR_MESSAGES', True)
+ if plaintext:
text = reporter.get_traceback_text()
return HttpResponseServerError(text, mimetype='text/plain')
else:
Something went wrong with that request. Please try again.