07/04/2008

A little Pylons/Routes helper

If you have trouble remembering route names in Pylons using Routes you might like to try adding these few lines to the end of the make_map function in config/routing.py before "return map":

    if config['debug']:
        route_names = map._routenames.keys()
        route_names.sort()
        for name in route_names:
            log.debug("%s = %s" % (name, map._routenames[name].routepath))

Now when pylons starts up you will get a list of all named routes printed to the log.

1 comment:

Unknown said...

Hey, thanks, I was searching for a way to list all the routes created, your code solved the problem!