On Tue, Apr 16, 2013 at 6:12 AM, Brantley Harris <deadwis...@gmail.com>wrote:
> Alex, I see http methods as being very basic, a part of the URL itself. > In other words, from the level of the web framework it's pointless to talk > about the URL as anything but a pair of request method and path. I couldn't disagree more on this. URLs and HTTP Methods are completely different things. They're even covered by different RFCs. No part of the URL spec includes mention of the the HTTP method. The HTTP method is part of a protocol for modifying resources identified by a URL. A URL describes a resource. It describes a "thing" that can have "stuff" done to it. That's why HTTP methods like GET/PUT/POST/DELETE are sometimes called "verbs" - they're "doing" words, describing what you're going to "do" to a resource. GET me the resource. PUT a new resource. DELETE the current resource. The dispatch process is - and should be - a two phase process: 1) Decide which resource is affected 2) Determine how to handle the request that you've received. So you want to have different behaviour for different verbs? Fine - then you put that at level 2. Yes, there's going to be a repeated pattern here, so you'd be well served to have some sort of framework to support this -- which is what the CBV base class is. If you don't like CBVs, feel free to propose something else - but don't try and confuse the task of identifying a resource with the task of correctly handling a request for a resource. To bring it back to your original example: > url('^objects/$', 'views.create_object', methods=['post', 'put'], name='create_object'), > url('^objects/$', 'views.get_objects', name='list_objects'), I completely fail to see the point of having different reverse endpoints for these two. At the end of the day, both of them reverse to the same URL - '/objects/'. Your proposed usage is presumably something like: requests.get(reverse('list_objects')) requests.post(reverse('create_object'), data) However, to drive home the point that the verb *isn't* part of the URL, the following would also work: requests.get(reverse('create_objects')) requests.post(reverse('list_objects'), data) That is, you can POST to your "GET" url, and GET from your "POST" URL, and you'd *get no error whatsoever*. So… what exactly is the point of having different URL names? Unless someone can explain why this is a good idea, count me as a big -1 on this. Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.