The httpy.utils subpackage collects several tools which may be of value to those building web applications with httpy. The translate function is actually used by httpy's own Static and Multiple responders. The parse_* functions are not used in the base package, but even the simplest web applications will need these or similar methods to extract application state from the Request object.
| request) |
| request) |
| request) |
| uri_path, fs_root[, defaults][, raw]) |
uri_path is the path component of a Request-URI (i.e.,
Request.path). fs_root is the filesystem path of the
directory in which the URI path should be rooted. defaults, if given, is a
sequence of names that should be considered default resources. If not given,
defaults is empty. If raw is given and it evaluates to True,
then translate() ignores defaults and performs no validation. If
raw is False, then validation proceeds according to this rubric:
translate() returns the filesystem path of the requested resource.