Rewriting An URL With Regular Expression Substitution in Routes
Posted
by Sean M
on Stack Overflow
See other posts from Stack Overflow
or by Sean M
Published on 2010-03-17T18:27:50Z
Indexed on
2010/03/17
18:31 UTC
Read the original article
Hit count: 527
In my Pylons app, some content is located at URLs that look like http://mysite/data/31415. Users can go to that URL directly, or search for "31415" via the search page. My constraints, however, mean that http://mysite/data/000031415 should go to the same page as the above, as should searches for "0000000000031415." Can I strip leading zeroes from that string in Routes itself, or do I need to do that substitution in the controller file? If it's possible to do it in routing.py, I'd rather do it there - but I can't quite figure it out from the documentation that I'm reading.
© Stack Overflow or respective owner