Commit 76f66932 authored by Jérome Perrin's avatar Jérome Perrin

check source code wip

parent a0b6b98f
from six import string_types as basestring
import re
import six
import json
from Products.ERP5Type.Utils import checkPythonSourceCode
......@@ -13,7 +13,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
......@@ -47,7 +47,9 @@ def checkPythonSourceCodeAsJSON(self, data, REQUEST=None):
else:
body = data['code']
message_list = checkPythonSourceCode(body.encode('utf8'), data.get('portal_type'))
if six.PY2:
body = body.encode('utf8')
message_list = checkPythonSourceCode(body, data.get('portal_type'))
for message_dict in message_list:
if is_script:
message_dict['row'] = message_dict['row'] - 4
......
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