Mercurial > code > home > repos > homeauto
view lib/cycloneerr.py @ 480:53ceedcc2809
dhcpleases partial rewrite
Ignore-this: 6a2b95612f0e3a2348397f2f068e5f58
author | drewp@bigasterisk.com |
---|---|
date | Sat, 20 Apr 2019 23:59:04 -0700 |
parents | a63549a50b3f |
children |
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), }