Mercurial > code > home > repos > homeauto
view lib/cycloneerr.py @ 449:ef7eba0551f2
collector partial py3+types update. WIP
Ignore-this: 3fe8cc7b09bbfc8bec7f5d6a5e1630b
author | drewp@bigasterisk.com |
---|---|
date | Thu, 18 Apr 2019 22:00:06 -0700 |
parents | 3d51d4b63497 |
children | a63549a50b3f |
line wrap: on
line source
try: import httplib except ImportError: import http.client as 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), }