view lib/cycloneerr.py @ 322:f420207c7fb4

switch neopixel libs. lost the r/g/b remapping feature Ignore-this: d18b5118d63f42db7ee6e6defefa90f2
author drewp@bigasterisk.com
date Fri, 20 Oct 2017 02:19:53 -0700
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),
        }