Commit 7ef91299 authored by wenjie.zheng's avatar wenjie.zheng

erp5_core: ERP5Site_checkNamingConventions, last version's code with compatibility modification.

parent 6740ff0d
......@@ -64,12 +64,11 @@
# - Check script names (from skin folders and workflows).\n
import re\n
ABBREVIATION_WORD_SET = ((\n
"BBAN", "BIC", "BOM", "CAD", "CRM", "CSV", "CTX", "DMS", "EAN", "ERP5",\n
"FAX", "GAP", "HTML", "IBAN", "ID", "KM", "MIME", "NVP", "ODT", "PDF",\n
"PDM", "PO", "RAM", "RSS", "SMS", "SQL", "SVN", "TALES", "TSV", "UBM",\n
"UID", "UOM", "URI", "URL", "VADS", "VAT", "VCS", "VPN", "ZODB",\n
"DNS", "IP", "CSS", "IMAP", "XML", "GPG", "GID", "TCP", "SOAP", "MRP",\n
"UNG", "BT", "BT5",\n
"BBAN", "BIC", "BOM", "BT", "BT5", "CAD", "CRM", "CSS","CSV", "CTX", "DMS", "DNS", \n
"EAN", "ERP5", "FAX", "GAP","GID", "GPG", "HTML", "HTTP", "IBAN", "ID",\n
"IMAP", "IP", "KM", "MIME", "MRP", "NVP", "ODT", "PDF", "PDM", "PO",\n
"RAM", "RSS", "SMS", "SOAP", "SQL", "SVN", "TALES", "TCP", "TSV", "UBM",\n
"UID", "UNG", "UOM", "URI", "URL", "VADS", "VAT", "VCS", "VPN", "XML", "ZODB",\n
))\n
\n
# List of words that do not need to be titlecased\n
......@@ -125,13 +124,17 @@ def checkField(folder, form, field):\n
path = folder.id + \'/\' + form.id\n
error_message = checkTitle(path, field.id, field.title(), field)\n
template_field = getFieldFromProxyField(field)\n
if path.endswith("FieldLibrary"):\n
if not(template_field is field):\n
if not(1 in [field.id.startswith(x) for x in (\'my_view_mode\',\n
\'my_core_mode_\', \'my_report_mode_\', \'my_list_mode_\', \'my_dialog_mode_\')]):\n
error_message += "%s: %s : Bad ID for a Field Library Field" %(path, field.id)\n
if template_field is None:\n
if field.get_value(\'enabled\'):\n
error_message += "Could not get a field from a proxy field %s" % field.id\n
else:\n
if template_field.meta_type == \'ListBox\':\n
a = template_field.getListMethodName()\n
if isListBox(field):\n
a = template_field.getListMethodName()\n
path += \'/listbox\'\n
for x in \'columns\', \'all_columns\':\n
for id, title in field.get_value(x):\n
......@@ -212,6 +215,9 @@ for folder in context.portal_skins.objectValues(spec=(\'Folder\',)):\n
message = checkTitle(\'/\'.join([folder.id, form.id]), \'Title of the Form itself\', form.title)\n
if message:\n
message_list.append(message)\n
if form.id.endswith("FieldLibrary"):\n
if not(form.id.startswith("Base_")):\n
message_list.append("%s/%s : Bad Form ID for a Field Library Form" % (folder.id, form.id))\n
for group in form.get_groups():\n
if group == \'hidden\':\n
continue\n
......@@ -265,6 +271,8 @@ for ptype in context.portal_types.objectValues():\n
if message:\n
message_list.append(message)\n
\n
if batch_mode:\n
return message_list\n
if message_list:\n
return ("%d problems found:\\n\\n" % len(message_list)) + \'\\n\'.join(message_list)\n
return "OK"\n
......@@ -274,7 +282,7 @@ return "OK"\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
<value> <string>batch_mode=False</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
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