Mercurial > code > home > repos > homeauto
annotate lib/cycloneerr.py @ 154:58c47bfe0ce5
add LiquidCrystal_V1.2.1 lib
Ignore-this: ddfe8b0c1d6e19f210684520859d5a57
author | drewp@bigasterisk.com |
---|---|
date | Sat, 03 Jan 2015 23:35:16 -0800 |
parents | be855a111619 |
children | 053fd552b675 |
rev | line source |
---|---|
4
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
diff
changeset
|
1 import httplib, cgi |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
diff
changeset
|
2 |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
diff
changeset
|
3 class PrettyErrorHandler(object): |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
diff
changeset
|
4 """ |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
diff
changeset
|
5 mix-in to improve cyclone.web.RequestHandler |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
diff
changeset
|
6 """ |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
diff
changeset
|
7 def get_error_html(self, status_code, **kwargs): |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
diff
changeset
|
8 try: |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
diff
changeset
|
9 tb = kwargs['exception'].getTraceback() |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
diff
changeset
|
10 except AttributeError: |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
diff
changeset
|
11 tb = "" |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
diff
changeset
|
12 return "<html><title>%(code)d: %(message)s</title>" \ |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
diff
changeset
|
13 "<body>%(code)d: %(message)s<pre>%(tb)s</pre></body></html>" % { |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
diff
changeset
|
14 "code": status_code, |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
diff
changeset
|
15 "message": httplib.responses[status_code], |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
diff
changeset
|
16 "tb" : cgi.escape(tb), |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
diff
changeset
|
17 } |