2013/4/15 Alex Ogier <alex.og...@gmail.com>

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

Django already has a syntax for that :

from django.conf.urls import *
from django.views.decorators.http import *

urlpatterns = patterns('',
    url(require_GET(view_that_only_accepts_get), name='accept-get'),
    url(require_POST(view_that_only_accepts_post), name='accept-post'),
    url(require_http_methods(['OPTIONS',
'DELETE'])(err_why_would_you_do_that), name='accept-options-delete'),
)

https://docs.djangoproject.com/en/dev/topics/http/decorators/#allowed-http-methods

Not every feature has to be supported via keyword arguments in the URLconf.
Many are expressed through decorators.

The URL dispatcher might have been designed differently in the first place,
but the current version appears to work quite well and I'm not convinced we
need to change it in this regard. Make that a -0!

-- 
Aymeric.

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