Commit 8da18165 by Jérome Perrin

CodingStyle: implement a basic ERP5Form.checkConsistency

Checking conventions for form, dialog and reports based on
parent fea57588
Pipeline #7288 failed with stage
in 0 seconds
......@@ -38,6 +38,8 @@ from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
from Products.CMFCore.utils import _checkPermission, getToolByName
from Products.CMFCore.exceptions import AccessControl_Unauthorized
from Products.ERP5Type import PropertySheet, Permissions
from Products.ERP5Type import CodingStyle
from Products.ERP5Type.ObjectMessage import ObjectMessage
from urllib import quote
from Products.ERP5Type.Globals import DTMLFile, get_request
......@@ -1320,6 +1322,27 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
def _getAcquireLocalRoles(self):
return True
def _checkConsistency(self, fixit=0, filter=None, **kw):
message_list = CodingStyle.checkConsistency(self, fixit=fixit, source_code=self.asXML())
object_relative_url = '/'.join(self.getPhysicalPath())[len(self.getPortalObject().getPath()):],
def addMessage(message):
prefix, method = self.getId().split('_', 1)
del prefix
if in ('form_view', 'form_list', 'form_dialog', 'report_view'):
if not method.startswith('view'):
addMessage('Form name must follow ${portal_type}_view.* naming')
if == 'form_dialog' and not method.endswith('Dialog'):
addMessage('Dialog form name must follow ${portal_type}_view.*Dialog naming')
if == 'report_view' and not method.endswith('Report'):
addMessage('Report form name must follow ${portal_type}_view.*Report naming')
return message_list
# utility function
def get_field_meta_type_and_proxy_flag(field):
if field.meta_type=='ProxyField':
......@@ -123,7 +123,7 @@ def checkConsistency(self, fixit=0, source_code=None):
if prefix not in getSkinPrefixList(self):
message='Wrong prefix %s for python script %s' % (prefix, document_id)))
message='Wrong prefix %s for %s %s' % (prefix, self.meta_type, document_id)))
# Make sure source code does not contain legacy callables
if source_code:
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 sign in to comment