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.

If we had a separate redirect layer, where would it reside?  As a
separate function in routing.py that wraps make_map?  How would you
define the source routes, and wouldn't that be essentially making a
second route map?  If you add variables, it starts looking even more
like a route map.  And what if the user wants to group redirects next
to their corresponding official route?  If they're in separate
functions, he can't.

Here we have a separate method (not .connect) defining the redirect.
That potentially allows all the code to be encapsulated into a
separate module.  Routes already has a redirect_to function, so it
already has some notion about redirection.  This is merely pushing it
to its conclusion.

One problem may be how to do the redirect in a framework-neutral way..
 Routes may have to simply raise a Redirect exception with the
destination, and let something else catch it and generate the
Response.

-- 
Mike Orr <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to