view lib/cycloneerr.py @ 1470:b1d8abc96f06

don't run rotations to zero when no one is requesting them. Ignore-this: 48894c486ba3ac9a229a3b34d4b81a0b
author drewp@bigasterisk.com
date Sun, 12 Jun 2016 19:05:45 +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),
        }