On 2/7/07, Simon Wittber <[EMAIL PROTECTED]> wrote: > > > I've built a custom REST controller for cherrypy, by modifiying > the .default method of my class to perform method dispatch based on > the request path, and the request method. > > This lets me access, for instance, a collection of users using this > URL: > > /users/ > > and a specific user using this sort of URL: > > /user/simon > > I've come up against a problem, when a user has the name 'default', > because cherrypy bypasses my dispatching logic. > > Cherrypy looks up my class, (users), then checks for an attribute > named 'default', which it then calls, which of course bypasses the > part of my logic which does dispatching based on the URL path. > > The same thing happens for the other methods in my class (get, create, > delete etc), as they are also exposed using the TG expose decorator > (in order to specify templates). I can get around this problem, by > simply not using the name 'default' as a unique resource identifier, > however this is suboptimal. > > Is there a way to turn of the cherrypy magic, and ask it to simply > call my default method for every request?
well there is a couple of things, first there was a change in CP3[1] so this will work until 1.1 which is the plan. in CP there is a "dispatcher" object that is what takes care of ... yes dispatching, but that is the one that actually implemented the "default method"[2] by the way did you saw http://www.cherrypy.org/wiki/RestfulResource ? [1] http://www.cherrypy.org/wiki/WhatsNewIn30#Dispatch [2] http://www.cherrypy.org/browser/trunk/cherrypy/_cpdispatch.py#L50 I have read ur blog entry from Karl's post... and I was wondering are you in the planet? http://planet.turbogears.org/ send Lee a link if you want to be hook on :) -Sw. > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" 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/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

