view lib/cycloneerr.py @ 1322:fb8aa1cb96e1

attempt zoom controls, but updates aren't working well. Ignore-this: af6aa879ca49bfb0d441c1886f7559fb
author Drew Perttula <drewp@bigasterisk.com>
date Fri, 03 Jun 2016 22:42:27 +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),
        }