Mercurial > code > home > repos > homeauto
view lib/cycloneerr.py @ 111:e4a4ee70a514
switch reasoning from restkit to async cyclone http client
Ignore-this: d7b8d0dba6374315a6eba63ca13e7c69
author | drewp@bigasterisk.com |
---|---|
date | Mon, 02 Sep 2013 20:57:18 -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), }