Re: Request dispatch based on http method/url

2006-04-24 Thread Alexis Smirnov
Thanks Malcolm and Rob.The idea of calling get_myresource() at the end of post_myresource() makes a lot of sense in case POST needs to return the representation of the new resource. For some objects it may not be practical or desirable (heavy objects, complex queries, performance-sensitive APIs). S

Re: Request dispatch based on http method/url

2006-04-23 Thread oggie rob
> What is the best way to dispatch to a method based on both HTTP method *and* > a URL? Basically you've found it, and it is a clean way to code. However you have to consider calling get_myresource() from post_myresource(), as you would probably do if the POST has errors. Typically manipulators

Re: Request dispatch based on http method/url

2006-04-23 Thread Malcolm Tredinnick
On Mon, 2006-04-24 at 01:23 +, Alexis Smirnov wrote: > Some of the URLs in my django application are addressable by both POST > and GET requests. This results in the code like this: > > urls.py: > > from django.conf.urls.defaults import * > > urlpatterns = patterns('', > (r'^myapp/myres

Request dispatch based on http method/url

2006-04-23 Thread Alexis Smirnov
Some of the URLs in my django application are addressable by both POST and GET requests. This results in the code like this: urls.py: from django.conf.urls.defaults import * urlpatterns = patterns('', (r'^myapp/myresource/$', 'myproj.myapp.myresource'), views.py: ... def myresourc