Commit 6d4cf452 authored by Jérome Perrin's avatar Jérome Perrin

configurator: use _createConstraintMessage for all configurator item

the API is not to return a list of strings, but a list of ConsistencyMessage
parent a4ffa1a7
......@@ -76,4 +76,4 @@ class AccountingPeriodConfiguratorItem(ConfiguratorItemMixin, XMLObject):
# no need to 'install' in the business template, because it's contain as
# subobject of an organisation we already added.
return ['Accounting Period %s should be created' % self.getTitle()]
return [self._createConstraintMessage('Accounting Period %s should be created' % self.getTitle())]
......@@ -96,5 +96,5 @@ class AdvancedPurchaseTradeConditionConfiguratorItem(ConfiguratorItemMixin, XMLO
self.install(trade_condition, business_configuration)
return ['Purchase Trade Condition with reference %s should be created' % \
self.getReference(),]
return [self._createConstraintMessage('Purchase Trade Condition with reference %s should be created' % \
self.getReference(),)]
......@@ -97,5 +97,5 @@ class AdvancedSaleTradeConditionConfiguratorItem(ConfiguratorItemMixin, XMLObjec
self.install(trade_condition, business_configuration)
return ['Sale Trade Condition with reference %s should be created' % \
self.getReference(),]
return [self._createConstraintMessage('Sale Trade Condition with reference %s should be created' % \
self.getReference(),)]
......@@ -61,7 +61,8 @@ class BusinessProcessConfiguratorItem(ConfiguratorItemMixin, XMLObject):
)
def _checkConsistency(self, fixit=False, **kw):
error_list = ["Business Process %s should be created" % self.getReference(),]
error_list = [
self._createConstraintMessage("Business Process %s should be created" % self.getReference())]
if fixit:
portal = self.getPortalObject()
business_process = portal.business_process_module.newContent(
......
......@@ -104,7 +104,8 @@ class CategoriesSpreadsheetConfiguratorItem(ConfiguratorItemMixin, XMLObject):
business_configuration = self.getBusinessConfigurationValue()
self.install(path, business_configuration)
else:
error_list.extend(["%s should be created" % category['path'] \
error_list.extend([
self._createConstraintMessage("%s should be created" % category['path'])
for category in category_list])
return error_list
......
......@@ -69,4 +69,4 @@ class CategoryConfiguratorItem(ConfiguratorItemMixin, XMLObject):
## add to customer template
business_configuration = self.getBusinessConfigurationValue()
self.install(category, business_configuration)
return ['Category %s should be created' % self.getTitle(),]
return [self._createConstraintMessage('Category %s should be created' % self.getTitle())]
......@@ -88,4 +88,4 @@ class OrganisationConfiguratorItem(ConfiguratorItemMixin, XMLObject):
## add to customer template
self.install(organisation, business_configuration)
return ['Organisation should be created',]
return [self._createConstraintMessage('Organisation should be created')]
......@@ -66,7 +66,7 @@ class PersonConfiguratorItem(XMLObject, ConfiguratorItemMixin):
error_list = []
person_list = self.acl_users.searchUsers(id=self.Person_getUserId(), exact_match=True)
if not person_list:
error_list.append("Person %s should be created" % self.Person_getUserId())
error_list.append(self._createConstraintMessage("Person %s should be created" % self.Person_getUserId()))
if fixit:
person_module = self.getPortalObject().person_module
person = person_module.newContent(portal_type="Person")
......
......@@ -85,10 +85,12 @@ class PortalTypeConfiguratorItem(ConfiguratorItemMixin, XMLObject):
],
)
return [
'Associate Property Sheets %r to %r in %r' % (
extra_property_sheet_list,
self.target_portal_type,
business_template_value.getTitle(),
),
self._createConstraintMessage(
'Associate Property Sheets %r to %r in %r' % (
extra_property_sheet_list,
self.target_portal_type,
business_template_value.getTitle(),
)
)
]
return []
......@@ -89,5 +89,5 @@ class PurchaseTradeConditionConfiguratorItem(ConfiguratorItemMixin, XMLObject):
self.install(trade_condition, business_configuration)
return ['Purchase Trade Condition with reference %s should be created' % \
self.getReference(),]
return [self._createConstraintMessage(
'Purchase Trade Condition with reference %s should be created' % self.getReference())]
......@@ -59,7 +59,7 @@ class RoleConfiguratorItem(ConfiguratorItemMixin, XMLObject):
, PropertySheet.DublinCore )
def _checkConsistency(self, fixit=False, **kw):
error_list = ['Roles should imported and created',]
error_list = [self._createConstraintMessage('Roles should imported and created')]
if fixit:
business_configuration = self.getBusinessConfigurationValue()
object_list = business_configuration.ConfigurationTemplate_readOOCalcFile(self.filename)
......
......@@ -77,4 +77,4 @@ class RuleConfiguratorItem(ConfiguratorItemMixin, XMLObject):
business_configuration = self.getBusinessConfigurationValue()
self.install(rule, business_configuration)
return ['Rule should be defined',]
return [self._createConstraintMessage('Rule should be defined')]
......@@ -90,5 +90,5 @@ class SaleTradeConditionConfiguratorItem(ConfiguratorItemMixin, XMLObject):
self.install(trade_condition, business_configuration)
return ['Sale Trade Condition with reference %s should be created' % \
self.getReference(),]
return [self._createConstraintMessage('Sale Trade Condition with reference %s should be created' % \
self.getReference(),)]
......@@ -61,7 +61,7 @@ class SecurityCategoryMappingConfiguratorItem(SkinConfiguratorItemMixin,
)
def _checkConsistency(self, fixit=False, **kw):
script_id = 'ERP5Type_getSecurityCategoryMapping'
error_list = ['%s should be created' % script_id,]
error_list = [self._createConstraintMessage('%s should be created' % script_id,)]
if fixit:
script_content = """return (
('ERP5Type_getSecurityCategoryFromAssignmentStrict', ['function']),
......
......@@ -72,4 +72,4 @@ class SitePropertyConfiguratorItem(ConfiguratorItemMixin, XMLObject):
bt = business_configuration.getSpecialiseValue()
bt.edit(template_site_property_id_list=id_list)
return ["The property %s should set on portal" % id_ for id_ in id_list]
return [self._createConstraintMessage("The property %s should set on portal" % id_) for id_ in id_list]
......@@ -83,4 +83,4 @@ class SolverConfiguratorItem(ConfiguratorItemMixin, XMLObject):
self.install(solver, business_configuration)
return ['Solvers should be created',]
return [self._createConstraintMessage('Solvers should be created')]
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