view lib/cycloneerr.py @ 428:d6a6076fce6e

use :connectedToNetwork on index table Ignore-this: c48bd43f2b18291ec1df2b70591a74d8
author drewp@bigasterisk.com
date Thu, 04 Apr 2019 02:22:04 -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),
        }