I have to redirect some URLs in my application.
/6025 -> /incident/6025
/6025/12345 -> /entry/12345
I could just route them to my new controllers but I want the browser
to get an actual redirect. I thought there would be a way to specify
redirects in the routing but there doesn't seem to be. Does that mean
I have to have a controller method for every redirect? Currently I
have:
# In config/routing.py
NUMERIC = R"\d+"
map.connect("/:orr_id", controller="main",
action="redirect_old_incident", requirements={"orr_id": NUMERIC})
map.connect("/:orr_id/:entry_id", controller="main",
action="redirect_old_entry",
requirements={"orr_id": NUMERIC, "entry_id": NUMERIC})
# In controllers/main.py
def redirect_old_incident(self, orr_id):
redirect_to("incident", orr_id=orr_id)
def redirect_old_entry(self, entry_id):
redirect_to("entry", entry_id=entry_id)
--
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
-~----------~----~----~----~------~----~------~--~---