A custom 500 handler which is AJAX-aware

1
2
3
4
5
def my_500(request):
    if request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest':
        return HttpResponse("")
    else:
        return render_to_response("500.html",{},context_instance=RequestContext(request))

Comments

buriy (on January 31, 2008):

how about to email error that was happened? ;)

#

(Forgotten your password?)

You may use Markdown syntax here, but raw HTML will be removed.