Commit 0f197d98 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 732896c4
...@@ -25,7 +25,8 @@ def checkPythonSourceCodeAsJSON(self, data, REQUEST=None): ...@@ -25,7 +25,8 @@ def checkPythonSourceCodeAsJSON(self, data, REQUEST=None):
signature = ", ".join(signature_parts) signature = ", ".join(signature_parts)
function_name = "function_name" 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, signature,
indent(data['code']) or " pass") indent(data['code']) or " pass")
else: else:
...@@ -36,7 +37,7 @@ def checkPythonSourceCodeAsJSON(self, data, REQUEST=None): ...@@ -36,7 +37,7 @@ def checkPythonSourceCodeAsJSON(self, data, REQUEST=None):
message_list = checkPythonSourceCode(body, data.get('portal_type')) message_list = checkPythonSourceCode(body, data.get('portal_type'))
for message_dict in message_list: for message_dict in message_list:
if is_script: if is_script:
message_dict['row'] = message_dict['row'] - 2 message_dict['row'] = message_dict['row'] - 3
else: else:
message_dict['row'] = message_dict['row'] - 1 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