Adrian Holovaty wrote:
> I think we ought
> to bite the bullet and add request.method, which would be a shortcut
> to a normalized (all caps?) version of request.META['REQUEST_METHOD'],
> which is cumbersome to type and might not (?) always be upper case.
>   
Per HTTP all request methods are defined in exact case ('GET', 'POST', 
'PUT', 'DELETE', ...). No browser will ever send it otherwise even if 
you have '<form method="post">' in HTML. So in a view method 'Post' is 
not HTTP's POST and should be treated as garbage.

Luckily Django's pattern of doing:

    if request.POST:
      #post
    else:
      #get

is safe since every unknown method will end up in 'GET' part which 
supposed to be idempotent anyway. And for better safety a user can list 
exact methods with @require_http_methods decorator (which is somewhat 
broken currently, I keep forgetting to file a ticket, will do now).

--~--~---------~--~----~------------~-------~--~----~
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