The pecan.routing module is the basis for all object-dispatch routing in Pecan.
Traverses the requested url path and returns the appropriate controller object, including default routes.
Handles common errors gracefully.
‘Walks’ the url path in search of an action for which a controller is implemented and returns that controller object along with what’s left of the remainder.
This function is used to define an explicit route for a path segment.
You generally only want to use this in situations where your desired path segment is not a valid Python variable/function name.
For example, if you wanted to be able to route to:
/path/with-dashes/
...the following is invalid Python syntax:
class Controller(object):
with-dashes = SubController()
...so you would instead define the route explicitly:
class Controller(object):
pass
pecan.route(Controller, 'with-dashes', SubController())