Pylons’ WSGI middlewares
Internally redirects a request based on status code
StatusCodeRedirect watches the response of the app it wraps. If the response is an error code in the errors sequence passed the request will be re-run with the path URL set to the path passed in.
This operation is non-recursive and the output of the second request will be used no matter what it is.
Should an application wish to bypass the error response (ie, to purposely return a 401), set environ['pylons.status_code_redirect'] = True in the application.
Initialize the ErrorRedirect
If debug is enabled, this function will return the app wrapped in the WebError EvalException middleware which displays interactive debugging sessions when a traceback occurs.
Otherwise, the app will be wrapped in the WebError ErrorMiddleware, and the errorware dict will be passed into it. The ErrorMiddleware handles sending an email to the address listed in the .ini file, under email_to.