summaryrefslogtreecommitdiff
path: root/paste/evalexception
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-04-21 21:36:33 +0200
committerVictor Stinner <victor.stinner@gmail.com>2015-04-21 21:36:33 +0200
commit26186eace02105067fe931db3f37b3dab94f619e (patch)
tree4839be9c48dd95b949024a3b960974d2f48fb271 /paste/evalexception
parent5757ea3b92078ea14f35f9fd5986b6c6471cf62c (diff)
downloadpaste-26186eace02105067fe931db3f37b3dab94f619e.tar.gz
Fix evalexception middleware on Python 3
* Encode body to UTF-8 on Python 3 * Encode log to UTF-8 on Python 3
Diffstat (limited to 'paste/evalexception')
-rw-r--r--paste/evalexception/middleware.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/paste/evalexception/middleware.py b/paste/evalexception/middleware.py
index 481d498..73fab98 100644
--- a/paste/evalexception/middleware.py
+++ b/paste/evalexception/middleware.py
@@ -332,7 +332,10 @@ class EvalException(object):
start_response('500 Internal Server Error',
headers,
exc_info)
- environ['wsgi.errors'].write('Debug at: %s\n' % view_uri)
+ msg = 'Debug at: %s\n' % view_uri
+ if six.PY3:
+ msg = msg.encode('utf8')
+ environ['wsgi.errors'].write(msg)
exc_data = collector.collect_exception(*exc_info)
debug_info = DebugInfo(count, exc_info, exc_data, base_path,
@@ -417,6 +420,8 @@ class DebugInfo(object):
'repost_button': repost_button or '',
'head_html': head_html,
'body': html}
+ if six.PY3:
+ page = page.encode('utf8')
return [page]
def eval_javascript(self):