Mercurial > code > home > repos > homeauto
view lib/cycloneerr/cycloneerr.py @ 1571:fd94061db75c
py3
Ignore-this: fd41253efc73d29e56aa5c3b0f2fb34f
darcs-hash:92db0f73f9b6da1e661fa2daff21d185adf8e782
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Thu, 14 May 2020 22:29:44 -0700 |
parents | c5bd44f90ced |
children |
line wrap: on
line source
try: import http.client as httplib except ImportError: import httplib # type: ignore import html 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" : html.escape(tb), }