Rules based url rewriter component, to get configurable RESTful urls
- class cubicweb.web.views.urlrewrite.URLRewriter(req, **extra)#
Base class for URL rewriters.
Url rewriters should have a rules dict that maps an input URI to something that should be used for rewriting.
The actual logic that defines how the rules dict is used is implemented in the rewrite method.
A priority attribute might be used to indicate which rewriter should be tried first. The higher the priority is, the earlier the rewriter will be tried.
- class cubicweb.web.views.urlrewrite.SimpleReqRewriter(req, **extra)#
The SimpleReqRewriters uses a rules dict that maps input URI (regexp or plain string) to a dictionary to update the request’s form.
If the input uri is a regexp, group substitution is allowed.
- rewrite(req, uri)#
for each input, output `in rules, if `uri matches input, req’s form is updated with output