Package cherrypy :: Module _cpwsgi :: Class InternalRedirector
[hide private]
[frames] | no frames]

Class InternalRedirector

source code

object --+
         |
        InternalRedirector

WSGI middleware which handles cherrypy.InternalRedirect.

When cherrypy.InternalRedirect is raised, this middleware traps it, rewrites the WSGI environ using the new path and query_string, and calls the next application again. Because the wsgi.input stream may have already been consumed by the next application, the redirected call will always be of HTTP method "GET", and therefore any params must be passed in the InternalRedirect object's query_string attribute. If you need something more complicated, make and raise your own exception and your own WSGI middleware to trap it. ;)

It would be a bad idea to raise InternalRedirect after you've already yielded response content, although an enterprising soul could choose to abuse this.

nextapp: the next application callable in the WSGI chain.

recursive: if False (the default), each URL (path + qs) will be stored, and, if the same URL is requested again, RuntimeError will be raised. If 'recursive' is True, no such error will be raised.

Instance Methods [hide private]
 
__init__(self, nextapp, recursive=False)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
__call__(self, environ, start_response) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, nextapp, recursive=False)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)