view lib/cycloneerr.py @ 902:f8c085cfaf72

add angular to laundry/static Ignore-this: dcc246f379a758e22953b9be1f4fd29c darcs-hash:20130831173525-312f9-c7586a9eeba90fd0c99ed9afdf7c9795f1bbc55e
author drewp <drewp@bigasterisk.com>
date Sat, 31 Aug 2013 10:35:25 -0700
parents bebb8f7c5a3e
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),
        }