Mercurial > code > home > repos > homeauto
view lib/cycloneerr.py @ 400:1b303e7542a3
start the next python rewrite of rfid pm_532 reader. Nim didn'
Ignore-this: b6a98b3f0f1c4147bedcc5d2bcfec226
t go well with asynchttpserer adn hreaind
author | drewp@bigasterisk.com |
---|---|
date | Wed, 27 Feb 2019 10:23:36 -0800 |
parents | be855a111619 |
children | 053fd552b675 |
line wrap: on
line source
import httplib, 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), }