On Fri, 2006-09-22 at 08:51 +0200, Simon de Haan wrote: > Hello everyone, > > 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 > > My implementation has been hacked together in a few minutes and isn't > pretty by any standards but Malcom suggested I pitch it here to start > a bit of a discussion. [...] > urlpatterns = patterns('', > # Example: > (r'^django_rest_urls/get/(?P<id>\d+)', > 'django_rest_urls.restful.views.get'), > (r'^django_rest_urls/(?P<id>\d+)', {'GET': > 'django_rest_urls.restful.views.get', > 'POST': > 'django_rest_urls.restful.views.post', > 'PUT': > 'django_rest_urls.restful.views.put', > 'DELETE': > 'django_rest_urls.restful.views.delete', > }),
For the record, my main complaint here is that suddenly we now start getting different behaviours, depending upon whether you have a function or a dictionary as the second argument. It really does make for code that is harder to read six to 24 months down the track. Malcolm --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
