Mike Orr wrote: > On Nov 23, 2007 5:46 AM, Paweł Stradomski <[EMAIL PROTECTED]> wrote: >> W liście Marcin Kasperski z dnia piątek 23 listopada 2007: >>> redirect routes need some detailed design. > >> I think that this does not belong to routes - but to pylons in general. >> In fact I believe that redirect function in routes is unnecessary - it should >> just take care of matching and generating urls, with no regard as to where >> the generated url is used. That would give a cleaner separation of concerns, >> and redirect function could just be defined in some layer using routes - and >> that function would accept parameters describing type of redirect (internal, >> moved permanently, moved temporarily, see other...) > > I'm afraid this is a case where purity hinders practicality. My > application has several tiny actions that do nothing but redirect > legacy URLs. The Routes map is the natural place for this, especially > since it's about ROUTE-ing or matching URLs to destinations. Routes > fulfills a function similar to mod_rewrite, which also handles both > internal and external redirects, so it provides a precedent.
I am guessing that something simple could be done right now, with a generic controller that takes one parameter, the new (possibly relative) URL to redirect to. Maybe like: map.connect('/legacy/:id', redirect_to='/new/:id', controller='redirector') Of course "controller" doesn't work right here. Is there a way to give a controller that isn't in the application namespace? Anyway, given that, if it also knows how to substitute :id for the id variable, one redirecting controller can handle all redirects. -- Ian Bicking : [EMAIL PROTECTED] : http://blog.ianbicking.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---