On Sat, Mar 21, 2009 at 9:51 AM, Alex Popescu < [email protected]> wrote:
> > Firstly thanks for your answers. In order to clarify some of the > remaining things: > > 1. Routes clarification > > HTTP 1.1 defines [1] 7 methods: OPTIONS, GET, HEAD, POST, PUT, DELETE, > TRACE (and reserves the CONNECT). The web2py routing is using to > determine the function name in the controller a part of the URL > according to the rule: > > /application/controller/[FUNCTION]/... > > What I need to create a RESTful app is that FUNCTION is automatically > deduced from the HTTP Request method and not from the controller > function name. So, my controller will be: > > class SomeController(object): > def get(self): > # all GET request to /application/somecontroller/ are getting > here > > def post(self): > # all POST requests to /application/somecontroller/ are getting > here In web2py, requests to application/controller/method are getting to method; You can can determine which method in request.reguest_method and direct the call the desired function; a quick look at http://www.web2py.com/examples/simple_examples/hello6 will give you an idea of what request and response variables you have to work with. > > > 2. Models and Data Access > > As I have already said this is a probably a good enough starting point > http://mdp.cti.depaul.edu/AlterEgo/default/show/189 and I will most > probably be able to take it from there. > > 3. Templates > > I'll re-read the documentation, but so far it looks like I should be > able to accomplish all 3 scenarios. > > I will not comment on "Django templates are 'ill-defined'" as I have > no idea. As far as I can tell the 2 models that are actually working > are: > - Sitemesh: decoration + basic composition (http:// > www.opensymphony.com/sitemesh/ > - Tiles: composition > > 4. Cross-cutting request/response cycle interceptors > > I think Yarko's answer is more in the direction I was looking, but > most probably I'll have to dig a bit into the code and come up with a > much more detailed question. > > Massimo's first part of the answer is not a solution that it couples > the code with the interceptors and the main goal is exactly the > opposite: to separate the cross-cutting orthogonal concerns. > > In conclusion, the only remaining question is if and how is it > possible to create a routing mechanism based on RESTful principles > that uses the HTTP request method information. Thanks for your thoughtful notes, Alex. Looking forward to hearing more from you. Regards, Yarko > > > Many thanks, > > ./alex > -- > .w( the_mindstorm )p. > Alexandru Popescu > > > > [1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html > [2] http://www.opensymphony.com/sitemesh/ > [3] http://struts.apache.org/1.x/struts-tiles/ > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" 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/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

