Doctor self.environ and perform an internal redirect.
When cherrypy.InternalRedirect is raised, this method is called. It
rewrites the WSGI environ using the new path and query_string, and calls
a new CherryPy Request object. Because the wsgi.input stream may have
already been consumed by the next application, the redirected call will
always be of HTTP method "GET"; therefore, any params must be
passed in the query_string argument, which is formed from
InternalRedirect.query_string when using that exception. If you need
something more complicated, make and raise your own exception and write
your own AppResponse subclass to trap it. ;)
It would be a bad idea to redirect after you've already yielded
response content, although an enterprising soul could choose to abuse
this.
|