Mercurial > code > home > repos > homeauto
comparison lib/cycloneerr/cycloneerr.py @ 1571:fd94061db75c
py3
Ignore-this: fd41253efc73d29e56aa5c3b0f2fb34f
darcs-hash:92db0f73f9b6da1e661fa2daff21d185adf8e782
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Thu, 14 May 2020 22:29:44 -0700 |
parents | c5bd44f90ced |
children |
comparison
equal
deleted
inserted
replaced
1570:56188eac38b5 | 1571:fd94061db75c |
---|---|
1 try: | 1 try: |
2 import http.client as httplib | 2 import http.client as httplib |
3 except ImportError: | 3 except ImportError: |
4 import httplib # type: ignore | 4 import httplib # type: ignore |
5 import cgi | 5 import html |
6 | 6 |
7 class PrettyErrorHandler(object): | 7 class PrettyErrorHandler(object): |
8 """ | 8 """ |
9 mix-in to improve cyclone.web.RequestHandler | 9 mix-in to improve cyclone.web.RequestHandler |
10 """ | 10 """ |
15 tb = "" | 15 tb = "" |
16 return "<html><title>%(code)d: %(message)s</title>" \ | 16 return "<html><title>%(code)d: %(message)s</title>" \ |
17 "<body>%(code)d: %(message)s<pre>%(tb)s</pre></body></html>" % { | 17 "<body>%(code)d: %(message)s<pre>%(tb)s</pre></body></html>" % { |
18 "code": status_code, | 18 "code": status_code, |
19 "message": httplib.responses[status_code], | 19 "message": httplib.responses[status_code], |
20 "tb" : cgi.escape(tb), | 20 "tb" : html.escape(tb), |
21 } | 21 } |