class Router(object):
A Router is an ordered collection of route->target pairs. It is used to efficiently match WSGI requests against a number of routes and return the first target that satisfies the request. The target may be anything, usually a string, ID or callable object. A route consists of a path-rule and a HTTP method.
The path-rule is either a static path (e.g. /contact
) or a dynamic
path that contains wildcards (e.g. /wiki/
). The wildcard syntax
and details on the matching order are described in docs:routing
.
Method | __init__ |
Undocumented |
Method | _compile |
Undocumented |
Method | _itertokens |
Undocumented |
Method | add |
Add a new rule or replace the target for an existing rule. |
Method | add_filter |
Add a filter. The provided function is called with the configuration string as parameter and must return a (regexp, to_python, to_url) tuple. The first element is a string, the last two are callables or None. |
Method | build |
Build an URL by filling the wildcards in a rule. |
Method | match |
Return a (target, url_agrs) tuple or raise HTTPError(400/404/405). |
Constant | _MAX_GROUPS_PER_PATTERN |
Undocumented |
Class Variable | default_filter |
Undocumented |
Class Variable | default_pattern |
Undocumented |
Class Variable | rule_syntax |
Undocumented |
Instance Variable | _groups |
Undocumented |
Instance Variable | builder |
Undocumented |
Instance Variable | dyna_regexes |
Undocumented |
Instance Variable | dyna_routes |
Undocumented |
Instance Variable | filters |
Undocumented |
Instance Variable | rules |
Undocumented |
Instance Variable | static |
Undocumented |
Instance Variable | strict_order |
Undocumented |