Commit 92fe086a authored by Jérome Perrin's avatar Jérome Perrin

core: PythonCodeUtils python3

parent 046a8f37
from six import string_types as basestring
import re
import six
import json
import sys
from zExceptions import ExceptionFormatter
......@@ -15,7 +15,7 @@ def checkPythonSourceCodeAsJSON(self, data, REQUEST=None):
"""
# XXX data is encoded as json, because jQuery serialize lists as []
if isinstance(data, basestring):
if isinstance(data, six.string_types):
data = json.loads(data)
# data contains the code, the bound names and the script params. From this
......@@ -49,8 +49,10 @@ def checkPythonSourceCodeAsJSON(self, data, REQUEST=None):
else:
body = data['code']
if six.PY2:
body = body.encode('utf8')
try:
message_list = checkPythonSourceCode(body.encode('utf8'), data.get('portal_type'))
message_list = checkPythonSourceCode(body, data.get('portal_type'))
except Exception:
message_list = [{
'type': 'E',
......
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