view lib/cycloneerr.py @ 1585:17da56a3c8df

group device captures into sessions, limit solver to specific ones Ignore-this: b91d858ebb435973b9742bed00567ffd
author Drew Perttula <drewp@bigasterisk.com>
date Tue, 30 May 2017 08:37:25 +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),
        }