documentation.mapping

The Viverra mapping module contains the Viverra URL resolution system, providing classes to link URLs flexibly to response-generating functions, and methods for those functions to generate compliant URLs in return.

A single instance of the UrlMap class is the core of this module's functionality; it provides the all-important resolve method that is set, by default, to config.urlresolve and is used by the core application to resolve a request path (from the concatenation of the WSGI environment's SCRIPT_NAME and PATH_INFO values) into a Viverra callable.

This module also contains the reverse-URL-mapping code, which becomes config.urlreverse and uses a lookup identifier to find the right URL pattern, then essential de-compiles the regular expression and fills in the arguments given to it to produce a correct URL. To do this, Viverra borrows the regex_helper utility module from Django -- licensing and copyright details for the Django module are provided in the comments in the module itself.