Mercurial > code > home > repos > homeauto
view lib/cycloneerr/cycloneerr.py @ 1384:a29a55f3429c
mqtt_graph_bridge to new build rules and to py3
Ignore-this: 1a064e89a2016ed583c1d4c9bbfd6f7c
darcs-hash:b40c5fcff313002f6468e7a94a2059f1dd5dd97c
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Thu, 09 May 2019 22:31:04 -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), }