Commit b9f0efad authored by Jérome Perrin's avatar Jérome Perrin

core: enable print_function in checkPythonSourceCodeAsJSON

This flags python2 style usage of print as a statement
parent 3a22b69d
......@@ -25,7 +25,8 @@ def checkPythonSourceCodeAsJSON(self, data, REQUEST=None):
signature = ", ".join(signature_parts)
function_name = "function_name"
body = "def %s(%s):\n%s" % (function_name,
body = "from __future__ import print_function\n"\
"def %s(%s):\n%s" % (function_name,
signature,
indent(data['code']) or " pass")
else:
......@@ -36,7 +37,7 @@ def checkPythonSourceCodeAsJSON(self, data, REQUEST=None):
message_list = checkPythonSourceCode(body, data.get('portal_type'))
for message_dict in message_list:
if is_script:
message_dict['row'] = message_dict['row'] - 2
message_dict['row'] = message_dict['row'] - 3
else:
message_dict['row'] = message_dict['row'] - 1
......
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