Mercurial > code > home > repos > light9
view lib/cycloneerr.py @ 1103:771f50f19b4b
single-line effect code now evals by changing <uri> into a suitable python object
Ignore-this: cde829f021be54bc7cfd63bddde43aa9
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Mon, 09 Jun 2014 07:10:39 +0000 |
parents | 473db8bebb8f |
children |
line wrap: on
line source
import httplib, cgi class PrettyErrorHandler(object): """ mix-in to improve cyclone.web.RequestHandler """ def get_error_html(self, status_code, **kwargs): try: tb = kwargs['exception'].getTraceback() except AttributeError: tb = "" return "<html><title>%(code)d: %(message)s</title>" \ "<body>%(code)d: %(message)s<pre>%(tb)s</pre></body></html>" % { "code": status_code, "message": httplib.responses[status_code], "tb" : cgi.escape(tb), }