Mercurial > code > home > repos > homeauto
comparison lib/cycloneerr.py @ 4:be855a111619
move a bunch of services into this tree, give them all web status pages
Ignore-this: a11e90f9d2cd9470565c743f54943c4b
author | drewp@bigasterisk.com |
---|---|
date | Mon, 08 Aug 2011 00:31:31 -0700 |
parents | |
children | 053fd552b675 |
comparison
equal
deleted
inserted
replaced
3:6c2e83a0c85b | 4:be855a111619 |
---|---|
1 import httplib, cgi | |
2 | |
3 class PrettyErrorHandler(object): | |
4 """ | |
5 mix-in to improve cyclone.web.RequestHandler | |
6 """ | |
7 def get_error_html(self, status_code, **kwargs): | |
8 try: | |
9 tb = kwargs['exception'].getTraceback() | |
10 except AttributeError: | |
11 tb = "" | |
12 return "<html><title>%(code)d: %(message)s</title>" \ | |
13 "<body>%(code)d: %(message)s<pre>%(tb)s</pre></body></html>" % { | |
14 "code": status_code, | |
15 "message": httplib.responses[status_code], | |
16 "tb" : cgi.escape(tb), | |
17 } |