On 15/04/13 10:21, Aymeric Augustin wrote:

> 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

This doesn't work if you want the same URL - the first one will match,
and return a 405 if the method isn't allowed, so you will never fall
through to the next one with the same URL where the method is allowed.

(Unless the URL dispatcher has started doing something very different
from what I what I expect it to do).


 A mosquito cried out in pain:
 "A chemist has poisoned my brain!"
 The cause of his sorrow
 was para-dichloro-

Luke Plant || http://lukeplant.me.uk/

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