On 6/17/06, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> There is already a way to test for posts via the request object:
> request.META['REQUEST_METHOD']. But your suggestion is not unreasonable,
> so best to file a ticket so that it can be considered without being
> forgotten.

I'm not convinced that it'd be a good thing to have request.POST
evaluate to True in these cases, but the reasoning is somewhat
pedantic.

First and foremost, there's a logical difference between the request
method and the request parameters, so it makes sense that a test for
the method could evaluate to True while a test for the parameters
could evaluate to False.

Second, since request.POST is supposed to be a "dictionary-like"
object, this would be unintuitive and, dare I say, "magical" behavior
-- an empty dictionary is False.

And, of course, there are practical considerations; if I want a view
to return particular output when someone POSTs with no content, now
instead of the expected "if not request.POST" -- checking for an empty
dictionary -- I have to come up with other tests like looking at the
length of request.POST to see if it's "empty but True". Again this is
unintuitive.

-- 
"May the forces of evil become confused on the way to your house."
  -- George Carlin

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to