Mercurial > code > home > repos > homeauto
view lib/cycloneerr.py @ 1102:06a511a96f20
resolve
Ignore-this: 7de9c6bf7542a108fd37776c6bdd9adb
darcs-hash:95e9e576119f8c277f786a9807582c6596610ccd
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Fri, 19 Aug 2016 10:59:39 -0700 |
parents | bebb8f7c5a3e |
children | 053fd552b675 |
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), }