paste.urlmap – Map URL paths

Map URL prefixes to WSGI applications. See URLMap

Module Contents

class paste.urlmap.URLMap(not_found_app=None)

URLMap instances are dictionary-like object that dispatch to one of several applications based on the URL.

The dictionary keys are URLs to match (like PATH_INFO.startswith(url)), and the values are applications to dispatch to. URLs are matched most-specific-first, i.e., longest URL first. The SCRIPT_NAME and PATH_INFO environmental variables are adjusted to indicate the new context.

URLs can also include domains, like http://blah.com/foo, or as tuples ('blah.com', '/foo'). This will match domain names; without the http://domain or with a domain of None any domain will be matched (so long as no other explicit domain matches).

paste.urlmap.urlmap_factory(loader, global_conf, **local_conf)
class paste.urlmap.PathProxyURLMap(map, base_paste_url, base_path, builder)

This is a wrapper for URLMap that catches any strings that are passed in as applications; these strings are treated as filenames (relative to base_path) and are passed to the callable builder, which will return an application.

This is intended for cases when configuration files can be treated as applications.

base_paste_url is the URL under which all applications added through this wrapper must go. Use "" if you want this to not change incoming URLs.