Commit c63939a6 authored by Vincent Pelletier's avatar Vincent Pelletier

ERP5Site_checkNamingConventions: Accept the use of 'your_' in field libraries.

The only use 'my_' has above 'your_' is to provide a default field value
without needing a TALES expression. This only gets applied based on the
field ID in the form being rendered. Field libraries are never meant to be
rendered, so using 'my_' is always (if harmless) pointless. What really
matters for the field naming convention (which exist to avoid collisions
with form properties) is that *some* prefix is used, be it 'my_' or
'your_'.
So update this check rule to tolerate 'your_' prefixes in addition to
'my_'.
Also, use 'not any([...])' instead of 'not 1 in [...]'.
parent 2370f5de
......@@ -75,8 +75,14 @@ def checkField(folder, form, field):
template_field = getFieldFromProxyField(field)
if path.endswith("FieldLibrary"):
if not(template_field is field):
if not(1 in [field.id.startswith(x) for x in ('my_view_mode_',
'my_core_mode_', 'my_report_mode_', 'my_list_mode_', 'my_dialog_mode_')]):
field_id = field.id
try:
prefix, field_id = field_id.split('_', 1)
except ValueError:
prefix = ''
if prefix not in ('my', 'your') and not any([field_id.startswith(x) for x in (
'view_mode_', 'core_mode_', 'report_mode_', 'list_mode_', 'dialog_mode_',
)]:
error_message += "%s: %s : Bad ID for a Field Library Field" % (path, field.id)
if template_field is None:
if field.get_value('enabled'):
......
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