3 from pylons import request, tmpl_context as c
5 from bluechips.lib.base import BaseController, render
7 class ErrorController(BaseController):
8 """Generates error documents as and when they are required.
10 The ErrorDocuments middleware forwards to ErrorController when error
11 related status codes are returned from the application.
13 This behaviour can be altered by changing the parameters to the
14 ErrorDocuments middleware in your config/middleware.py file.
18 """Render the error document"""
19 resp = request.environ.get('pylons.original_response')
20 c.code = cgi.escape(request.GET.get('code', resp.status))
21 return render('/error.mako')