For me, it just seemed that Routes was an easy way out of creating a custom default method for every controller to get the URL's "just so". It may be me doing things wrong, but I can't seem to get the URL structure I want with cherrypy alone. I can get *part* of it, but not the whole shebang.
If I want the URL to stay nice and not be redirected using the old, crufty URL's I have to use InternalRedirect, which I can't seem to get working as the template for the exposed function (default) is wrong. As it is, unless someone can show me a way of grabbing the stuff in a decorator just by having an instance of a decorated function, routes won't work without some major messing around. So, in my case, it seems I'm not grasping the proper way of using CherryPy itself to generate nice, neat url's without having superflous controller classes just to create the URL structure. Does anyone have any examples of how they're building their apps with nice URL's? Lee On 12/12/05, Kevin Dangoor <[EMAIL PROTECTED]> wrote: > > I'm going to take a step back on this one. I've had a couple of > private email conversations where this has come up, and I've been > meaning to make a blog post about it. I'll bring it up for > conversation here, though, since Lee has opened the topic. > > Particularly with positional parameters, CherryPy makes it easy to > construct useful, descriptive URLs. You just instantiate the object > that's going to respond to some URLs and drop it in the part of the > hierarchy you want. Just like that, It starts answer requests. No > separate configuration needed... everything is just assembled as a > Python program. > > I have considered Routes integration for a use case that is not > handled quite as directly by CherryPy: providing compatibility with an > existing set of URLs. I think there would be value in using Routes to > take a look at an incoming URL, match it against one of these mapped > routes that exist for compatibility and point it to a place in your > controller hierarchy that should answer the request. With that use > case in mind, that would imply different things about the > implementation. > > I'd be interested in hearing of other use cases (if there are any) > where CherryPy doesn't handle the task well. > > (BTW, I should note that I'm specifically talking about where Routes > might have a place as part of TurboGears. I have no issue with someone > posting a recipe for something they're trying out.) > > Kevin > > On 12/12/05, Lee McFadden <[EMAIL PROTECTED]> wrote: > > > > Ok, I'm kinda stuck here. > > > > The method I posted on the Wiki skips the @turbogears.expose for each > > function (which is actually what I should expect, had I really read > > things properly) as the root function is being mutated into the > > function we actually want. > > > > Is there a way of accessing a function's decorator from another > > function? I've been searching and can't find a way of doing it. > > Since it's there in the code, plain as day, there must be a way of > > getting the attributes assigned to the original decorator and 'self > > decorating' the new function? > > > > Thanks, > > > > Lee > > > > > -- > Kevin Dangoor > Author of the Zesty News RSS newsreader > > email: [EMAIL PROTECTED] > company: http://www.BlazingThings.com > blog: http://www.BlueSkyOnMars.com >

