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

core: include components consistency errors in BusinessTemplate_getPythonSourceCodeMessageList

Components also have some extra checks in checkConsistency, we should
include this in coding style test.
parent 37e7ef32
...@@ -66,9 +66,17 @@ def checkPythonScript(script_instance, script_path): ...@@ -66,9 +66,17 @@ def checkPythonScript(script_instance, script_path):
def checkComponent(component_instance): def checkComponent(component_instance):
"""Check a component, adding messages to global `line_list` """Check a component, adding messages to global `line_list`
""" """
component_relative_url = component_instance.getRelativeUrl()
for consistency_message in component_instance.checkConsistency():
line_list.append(
Message(
location=component_relative_url,
message=consistency_message.getMessage().translate(),
edit_url=component_relative_url,
jio_key=component_relative_url,),)
for annotation in json.loads(portal.ERP5Site_checkPythonSourceCodeAsJSON( for annotation in json.loads(portal.ERP5Site_checkPythonSourceCodeAsJSON(
{'code': unicode(component_instance.getTextContent(), 'utf8')}))['annotations']: {'code': unicode(component_instance.getTextContent(), 'utf8')}))['annotations']:
annotation['component_path'] = component_instance.getRelativeUrl() annotation['component_path'] = component_relative_url
line_list.append( line_list.append(
Message( Message(
location="{component_path}:{row}:{column}".format(**annotation), location="{component_path}:{row}:{column}".format(**annotation),
......
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