I'm not sure if this is a bug (though it probably is) and wanted to
review here before submitting a report. Consider the following
handler:


def test(req):
    if req.method == "POST":
        HttpResponse("the request was a POST")
    else:
        HttpResponse("the request was not a POST")


This works as long as the client doesn't send any data. However, if
any data is included in the request payload, the HttpResponse call
mysteriously fails and redirects to [origin]/internal_error.html which
in turn ends up as a 404 if you don't have such a page in your public
directory or a catch all handler.

Trying to catch this exception is impossible because the handler has
to call HttpResponse at some point. Since there is no way to control
whether the client decides to send data, (even if they shouldn't) this
appears to result in an un-handleable circumstance. Is this the
intended behavior, a bug or am I crazy for some other reason?

*An additional point of interest - changing the handler to access
req.POST anywhere before HttpResponse is called, even if the actual
data isn't processed or examined directly, seems to solve this problem.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to