Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trailing slashes in Pylons Routes

What is the best way to make trailing slashes not matter in the latest version of Routes (1.10)? I currently am using the clearly non-DRY:

map.connect('/logs/', controller='logs', action='logs')
map.connect('/logs', controller='logs', action='logs')

I think that turning minimization on would do the trick, but am under the impression that it was disabled in the newer versions of Routes for a reason. Unfortunately documentation doesn't seem to have caught up with Routes development, so I can't find any good resources to go to. Any ideas?

like image 401
wxs Avatar asked Oct 24 '08 20:10

wxs


1 Answers

The following snippet added as the very last route worked for me:

map.redirect('/*(url)/', '/{url}',
             _redirect_code='301 Moved Permanently')
like image 116
Marius Gedminas Avatar answered Sep 28 '22 10:09

Marius Gedminas