Mercurial > code > home > repos > homeauto
view lib/cycloneerr/cycloneerr.py @ 1366:5836e88a0287
py3 and new build
Ignore-this: 69cf69e5d43adfa65b3f62c5c0af2014
darcs-hash:a82563e9bfce399590ffd2229d997b490c0b038d
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Wed, 01 May 2019 00:30:54 -0700 |
parents | c5bd44f90ced |
children | fd94061db75c |
line wrap: on
line source
try: import http.client as httplib except ImportError: import httplib # type: ignore import 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), }