Simon de Haan wrote:
> I've posted a patch in trac which will allow the urlresolver to
> select a view depending on the HTTP method (GET,POST,PUT,DELETE, etc..)
> Its posted at http://code.djangoproject.com/ticket/2784
> [..]
> I'd be interested in your ideas.
The URL resolver could also try to find a matching view for the current
request method by appending "_on_%s"  % request.METHOD.lower() after
the view name:
  urlpatterns = patterns('',
      (r'^articles/(\d{4})/(\d{2})/(\d+)/$', 'news.views.article'),
  )
When using POST the resolver should then try to call
"news.views.article_on_post" first.
This can be easy implemented and would keep the look of the urlconf
clean.

Or you end up with something like Cocoon's sitemaps where you can
dispatch on every header and not only PATH_INFO:
  resolver = sitemap('',
      (
        { "PATH_INFO":
r'^articles/(\d{4})/(\d{2})/(\d+)/$',
          "REQUEST_METHOD": "POST"
        },  'news.views.article'
      ),
  )


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to