Back to index

moin  1.9.0~rc2
Public Member Functions
MoinMoin.support.werkzeug.contrib.wrappers.ReverseSlashBehaviorRequestMixin Class Reference

List of all members.

Public Member Functions

def path
def script_root

Detailed Description

This mixin reverses the trailing slash behavior of :attr:`script_root`
and :attr:`path`.  This makes it possible to use :func:`~urlparse.urljoin`
directly on the paths.

Because it changes the behavior or :class:`Request` this class has to be
mixed in *before* the actual request class::

    class MyRequest(ReverseSlashBehaviorRequestMixin, Request):
        pass

This example shows the differences (for an application mounted on
`/application` and the request going to `/application/foo/bar`):

    +---------------+-------------------+---------------------+
    |               | normal behavior   | reverse behavior    |
    +===============+===================+=====================+
    | `script_root` | ``/application``  | ``/application/``   |
    +---------------+-------------------+---------------------+
    | `path`        | ``/foo/bar``      | ``foo/bar``         |
    +---------------+-------------------+---------------------+

Definition at line 127 of file wrappers.py.


Member Function Documentation

Requested path as unicode.  This works a bit like the regular path
info in the WSGI environment but will not include a leading slash.

Definition at line 151 of file wrappers.py.

00151 
00152     def path(self):
00153         """Requested path as unicode.  This works a bit like the regular path
00154         info in the WSGI environment but will not include a leading slash.
00155         """
00156         path = (self.environ.get('PATH_INFO') or '').lstrip('/')
00157         return _decode_unicode(path, self.charset, self.encoding_errors)

Here is the call graph for this function:

Here is the caller graph for this function:

The root path of the script includling a trailing slash.

Definition at line 159 of file wrappers.py.

00159 
00160     def script_root(self):
00161         """The root path of the script includling a trailing slash."""
00162         path = (self.environ.get('SCRIPT_NAME') or '').rstrip('/') + '/'
00163         return _decode_unicode(path, self.charset, self.encoding_errors)

Here is the call graph for this function:


The documentation for this class was generated from the following file: