Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Stable/1.5.x #844

Closed
wants to merge 2 commits into from

2 participants

@rodrigopmatias

The configurable way for output TECHNICAL 500 RESPONSE with Ajax request.

rodrigopmatias added some commits
@rodrigopmatias rodrigopmatias Update django/views/debug.py
Configurable technical_500_response to force output as html with request Ajax.
8a6d6af
@rodrigopmatias rodrigopmatias Update django/conf/global_settings.py
Configurable paramter for force the output of TECHNICAL_500_RESPONSE use HTML and not Text plain with Ajax request.
cd4fe38
@rodrigopmatias

@ramiro can you see my contribuition for thechnical_500_response?

@ramiro
Collaborator

If you really want this to get to be considered open a ticket on the Trac issue tracker and explain there the reasoning for the proposal, what use cases does it solve.

But I'm not sure you are going to get traction for adding yet another setting. So please don't get mad if/when this particular conribution gets rejected.

The patch certainly needs to be more idiomatic. The "is False" check and the semantics of the TECHNICAL_500_RESPONSE_HAS_HTML are wrong IMO.

@rodrigopmatias

@ramiro obrigado pelas considerações vih que você também é latino.
@ramiro thanks for the tips, I noticed that you are also Latin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 25, 2013
  1. @rodrigopmatias

    Update django/views/debug.py

    rodrigopmatias authored
    Configurable technical_500_response to force output as html with request Ajax.
  2. @rodrigopmatias

    Update django/conf/global_settings.py

    rodrigopmatias authored
    Configurable paramter for force the output of TECHNICAL_500_RESPONSE use HTML and not Text plain with Ajax request.
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 1 deletion.
  1. +1 −0  django/conf/global_settings.py
  2. +2 −1  django/views/debug.py
View
1  django/conf/global_settings.py
@@ -11,6 +11,7 @@
DEBUG = False
TEMPLATE_DEBUG = False
+TECHNICAL_500_RESPONSE_HAS_HTML = False
# Whether the framework should propagate raw exceptions rather than catching
# them. This is useful under some testing situations and should never be used
View
3  django/views/debug.py
@@ -61,8 +61,9 @@ def technical_500_response(request, exc_type, exc_value, tb):
Create a technical server error response. The last three arguments are
the values returned from sys.exc_info() and friends.
"""
+ html_force = getattr(settings, 'TECHNICAL_500_RESPONSE_HAS_HTML', False)
reporter = ExceptionReporter(request, exc_type, exc_value, tb)
- if request.is_ajax():
+ if html_force is False and request.is_ajax():
text = reporter.get_traceback_text()
return HttpResponseServerError(text, content_type='text/plain')
else:
Something went wrong with that request. Please try again.