view lib/cycloneerr.py @ 1436:d0d5900a8031

collector run the blocking dmx output calls in another thread, so they don't add delay to our http server Ignore-this: b5385085b654e1ac0b8018e6813f36e
author drewp@bigasterisk.com
date Sat, 11 Jun 2016 20:30:34 +0000
parents 473db8bebb8f
children
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),
        }