I agree, I think there are use cases for both types of dispatch, and it
seems clean and well-defined to make a route that is valid for only a
subset of HTTP methods. I guess there are a few corner cases to think
about, for example should Django's url resolver start returning 405s
instead of 404s when it's just the method that doesn't match? But that kind
of stuff is easily worked out. I like the syntax too, a list passed as a
kwarg to the url() function. So +1 from me.


On Sun, Apr 14, 2013 at 4:29 PM, Brantley Harris <deadwis...@gmail.com>wrote:

> On Sun, Apr 14, 2013 at 2:40 PM, Luke Plant <l.plant...@cantab.net> wrote:
>
>> One reason for not doing this kind of despatch is that handling for
>>  different HTTP methods often involves a lot of common code. The classic
>> form workflow would become longer, more complicated and/or less DRY if
>> it was implemented using two functions instead of one:
>>
>> https://docs.djangoproject.com/en/dev/topics/forms/#using-a-form-in-a-view
>>
>> So, I would disagree that dispatching on HTTP verb would lead to vastly
>> better code - it could easily make things worse.
>>
>>
> Form handling seems like the only common place that a view would want to
> handle different methods coming in, most of the time it makes much more
> sense to break up the view into one for each HTTP Method.  In essence, what
> we're doing is creating our own mini-dispatch in the view and it's clumsy
> most of the time and leads to less RESTful layouts.
>
>  --
> 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.
>
>
>

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


Reply via email to