Mercurial > code > home > repos > homeauto
view lib/cycloneerr/cycloneerr.py @ 1430:445e24e8c8bb
lib upgrades; fix a static http server path
Ignore-this: f48022f37590e8bdb16957c49168d31b
darcs-hash:018ffeb640e1ce9307daf4a320fbd0c807e66a07
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Thu, 08 Aug 2019 16:54:46 -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), }