Commit 741f103d authored by Jérome Perrin's avatar Jérome Perrin Committed by Arnaud Fontaine

*: response.write expects bytes

parent 0acecb50
......@@ -20,7 +20,7 @@ zipfile (bool)
When true, the result is a zip file containing profiling result along with the python code (and, when not possible, the disassembled bytecode) of all files which appear in the profiling result.
When false, the result is a bare profiling result (cachegrind file format).
"""
from six.moves import cStringIO as StringIO
import io
portal = context.getPortalObject()
if statistic:
profiler, retriever = portal.ERP5Site_getStatisticalProfilerAndThread(single=True)
......@@ -39,7 +39,7 @@ if zipfile:
data, content_type = profiler.asZip()
filename = 'statistical_' + filename + '.zip'
else:
out = StringIO()
out = io.BytesIO()
profiler.callgrind(out, relative_path=True)
data = out.getvalue()
content_type = 'application/x-kcachegrind'
......
......@@ -17,9 +17,9 @@ try:
except Exception as e:
response.setStatus(500)
try:
response.write(str(e[1]))
response.write(str(e[1]).encode())
except Exception:
response.write(str(e))
response.write(str(e).encode())
return
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment