Commit 03e92fd9 authored by Rafael Monnerat's avatar Rafael Monnerat

Use cleaner method names into configurator items, in short 'build calls _build'

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45108 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 09a690cd
...@@ -55,7 +55,7 @@ class AccountConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -55,7 +55,7 @@ class AccountConfiguratorItem(ConfiguratorItemMixin, XMLObject):
, PropertySheet.DublinCore , PropertySheet.DublinCore
, PropertySheet.Account ) , PropertySheet.Account )
def build(self, business_configuration): def _build(self, business_configuration):
portal = self.getPortalObject() portal = self.getPortalObject()
account_module = portal.account_module account_module = portal.account_module
......
...@@ -55,7 +55,7 @@ class AccountingPeriodConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -55,7 +55,7 @@ class AccountingPeriodConfiguratorItem(ConfiguratorItemMixin, XMLObject):
, PropertySheet.DublinCore , PropertySheet.DublinCore
, PropertySheet.Task ) , PropertySheet.Task )
def build(self, business_configuration): def _build(self, business_configuration):
portal = self.getPortalObject() portal = self.getPortalObject()
organisation_id = business_configuration.\ organisation_id = business_configuration.\
getGlobalConfigurationAttr('organisation_id') getGlobalConfigurationAttr('organisation_id')
......
...@@ -394,7 +394,7 @@ class BusinessConfiguration(Item): ...@@ -394,7 +394,7 @@ class BusinessConfiguration(Item):
configuration_item_list = [x for x in configuration_save.contentValues()] configuration_item_list = [x for x in configuration_save.contentValues()]
configuration_item_list.sort(lambda x, y: cmp(x.getIntId(), y.getIntId())) configuration_item_list.sort(lambda x, y: cmp(x.getIntId(), y.getIntId()))
for configurator_item in configuration_item_list: for configurator_item in configuration_item_list:
configurator_item.activate(**kw).buildItem(self.getRelativeUrl()) configurator_item.activate(**kw).build(self.getRelativeUrl())
kw["after_tag"] = kw["tag"] kw["after_tag"] = kw["tag"]
kw["tag"] = "configurator_item_%s_%s" % (configurator_item.getId(), kw["tag"] = "configurator_item_%s_%s" % (configurator_item.getId(),
configurator_item.getUid()) configurator_item.getUid())
...@@ -404,7 +404,7 @@ class BusinessConfiguration(Item): ...@@ -404,7 +404,7 @@ class BusinessConfiguration(Item):
time.time() - start)) time.time() - start))
if execute_after_setup_script: if execute_after_setup_script:
kw["after_method_id"] = ["buildItem", 'immediateReindexObject', \ kw["after_method_id"] = ["build", 'immediateReindexObject', \
"recursiveImmediateReindexObject"] "recursiveImmediateReindexObject"]
self.activate(**kw).ERP5Site_afterConfigurationSetup() self.activate(**kw).ERP5Site_afterConfigurationSetup()
......
...@@ -56,7 +56,7 @@ class BusinessProcessConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -56,7 +56,7 @@ class BusinessProcessConfiguratorItem(ConfiguratorItemMixin, XMLObject):
, PropertySheet.Reference , PropertySheet.Reference
) )
def build(self, business_configuration): def _build(self, business_configuration):
portal = self.getPortalObject() portal = self.getPortalObject()
business_process = portal.business_process_module.newContent( business_process = portal.business_process_module.newContent(
portal_type="Business Process", portal_type="Business Process",
......
...@@ -55,7 +55,7 @@ class CatalogKeywordKeyConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -55,7 +55,7 @@ class CatalogKeywordKeyConfiguratorItem(ConfiguratorItemMixin, XMLObject):
, PropertySheet.CategoryCore , PropertySheet.CategoryCore
, PropertySheet.DublinCore ) , PropertySheet.DublinCore )
def build(self, business_configuration): def _build(self, business_configuration):
portal = self.getPortalObject() portal = self.getPortalObject()
catalog = portal.portal_catalog.getSQLCatalog() catalog = portal.portal_catalog.getSQLCatalog()
key_list = list(catalog.getProperty('sql_catalog_keyword_search_keys', ())) key_list = list(catalog.getProperty('sql_catalog_keyword_search_keys', ()))
......
...@@ -64,7 +64,7 @@ class CategoriesSpreadsheetConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -64,7 +64,7 @@ class CategoriesSpreadsheetConfiguratorItem(ConfiguratorItemMixin, XMLObject):
, PropertySheet.ConfiguratorItem , PropertySheet.ConfiguratorItem
) )
def build(self, business_configuration): def _build(self, business_configuration):
portal = self.getPortalObject() portal = self.getPortalObject()
ctool = portal.portal_categories ctool = portal.portal_categories
......
...@@ -54,7 +54,7 @@ class CategoryConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -54,7 +54,7 @@ class CategoryConfiguratorItem(ConfiguratorItemMixin, XMLObject):
, PropertySheet.CategoryCore , PropertySheet.CategoryCore
, PropertySheet.DublinCore) , PropertySheet.DublinCore)
def build(self, business_configuration): def _build(self, business_configuration):
portal = self.getPortalObject() portal = self.getPortalObject()
category_root = portal.portal_categories[self.category_root] category_root = portal.portal_categories[self.category_root]
object_id = self.object_id object_id = self.object_id
......
...@@ -57,7 +57,7 @@ class CurrencyConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -57,7 +57,7 @@ class CurrencyConfiguratorItem(ConfiguratorItemMixin, XMLObject):
, PropertySheet.Resource , PropertySheet.Resource
, PropertySheet.Reference ) , PropertySheet.Reference )
def build(self, business_configuration): def _build(self, business_configuration):
currency_module = self.getPortalObject().currency_module currency_module = self.getPortalObject().currency_module
title = self.getTitle() title = self.getTitle()
......
...@@ -58,7 +58,7 @@ class CustomerBT5ConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -58,7 +58,7 @@ class CustomerBT5ConfiguratorItem(ConfiguratorItemMixin, XMLObject):
, PropertySheet.CategoryCore , PropertySheet.CategoryCore
, PropertySheet.DublinCore ) , PropertySheet.DublinCore )
def build(self, business_configuration): def _build(self, business_configuration):
template_tool = getToolByName(self.getPortalObject(), template_tool = getToolByName(self.getPortalObject(),
'portal_templates') 'portal_templates')
bt5 = template_tool.newContent(portal_type="Business Template", \ bt5 = template_tool.newContent(portal_type="Business Template", \
......
...@@ -55,7 +55,7 @@ class ExportCustomerBT5ConfiguratorItem(XMLObject, ConfiguratorItemMixin): ...@@ -55,7 +55,7 @@ class ExportCustomerBT5ConfiguratorItem(XMLObject, ConfiguratorItemMixin):
, PropertySheet.CategoryCore , PropertySheet.CategoryCore
, PropertySheet.DublinCore ) , PropertySheet.DublinCore )
def build(self, business_configuration): def _build(self, business_configuration):
portal = self.getPortalObject() portal = self.getPortalObject()
template_tool = getToolByName(portal, 'portal_templates') template_tool = getToolByName(portal, 'portal_templates')
bt5_obj = business_configuration.getSpecialiseValue() bt5_obj = business_configuration.getSpecialiseValue()
......
...@@ -55,7 +55,7 @@ class OrganisationConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -55,7 +55,7 @@ class OrganisationConfiguratorItem(ConfiguratorItemMixin, XMLObject):
, PropertySheet.DublinCore , PropertySheet.DublinCore
, PropertySheet.Organisation ) , PropertySheet.Organisation )
def build(self, business_configuration): def _build(self, business_configuration):
""" Setup organisation. """ """ Setup organisation. """
portal = self.getPortalObject() portal = self.getPortalObject()
organisation = portal.organisation_module.newContent(portal_type="Organisation") organisation = portal.organisation_module.newContent(portal_type="Organisation")
......
...@@ -54,7 +54,7 @@ class PermissionConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -54,7 +54,7 @@ class PermissionConfiguratorItem(ConfiguratorItemMixin, XMLObject):
, PropertySheet.CategoryCore , PropertySheet.CategoryCore
, PropertySheet.DublinCore ) , PropertySheet.DublinCore )
def build(self, business_configuration): def _build(self, business_configuration):
template_module_id_list = [] template_module_id_list = []
module_permissions_map = {} module_permissions_map = {}
sheets_dict = business_configuration.ConfigurationTemplate_readOOCalcFile(\ sheets_dict = business_configuration.ConfigurationTemplate_readOOCalcFile(\
......
...@@ -59,7 +59,7 @@ class PersonConfiguratorItem(XMLObject, ConfiguratorItemMixin): ...@@ -59,7 +59,7 @@ class PersonConfiguratorItem(XMLObject, ConfiguratorItemMixin):
, PropertySheet.Person , PropertySheet.Person
, PropertySheet.Login) , PropertySheet.Login)
def build(self, business_configuration): def _build(self, business_configuration):
portal = self.getPortalObject() portal = self.getPortalObject()
person = portal.person_module.newContent(portal_type="Person") person = portal.person_module.newContent(portal_type="Person")
group_id = getattr(aq_base(self), 'group_id', None) group_id = getattr(aq_base(self), 'group_id', None)
......
...@@ -54,7 +54,7 @@ class PortalTypeConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -54,7 +54,7 @@ class PortalTypeConfiguratorItem(ConfiguratorItemMixin, XMLObject):
, PropertySheet.CategoryCore , PropertySheet.CategoryCore
, PropertySheet.DublinCore ) , PropertySheet.DublinCore )
def build(self, business_configuration): def _build(self, business_configuration):
portal = self.getPortalObject() portal = self.getPortalObject()
# Support adding new property sheet to portal type information. # Support adding new property sheet to portal type information.
......
...@@ -38,7 +38,7 @@ class PortalTypeRolesSpreadsheetConfiguratorItem(ConfiguratorItemMixin, XMLObjec ...@@ -38,7 +38,7 @@ class PortalTypeRolesSpreadsheetConfiguratorItem(ConfiguratorItemMixin, XMLObjec
, PropertySheet.ConfiguratorItem , PropertySheet.ConfiguratorItem
) )
def build(self, business_configuration): def _build(self, business_configuration):
portal = self.getPortalObject() portal = self.getPortalObject()
self._readSpreadSheet() self._readSpreadSheet()
for type_name, role_list in self._spreadsheet_cache.items(): for type_name, role_list in self._spreadsheet_cache.items():
......
...@@ -85,7 +85,7 @@ class PreferenceConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -85,7 +85,7 @@ class PreferenceConfiguratorItem(ConfiguratorItemMixin, XMLObject):
) )
def build(self, business_configuration): def _build(self, business_configuration):
portal = self.getPortalObject() portal = self.getPortalObject()
organisation_id = business_configuration.\ organisation_id = business_configuration.\
getGlobalConfigurationAttr('organisation_id') getGlobalConfigurationAttr('organisation_id')
......
...@@ -57,7 +57,7 @@ class PurchaseTradeConditionConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -57,7 +57,7 @@ class PurchaseTradeConditionConfiguratorItem(ConfiguratorItemMixin, XMLObject):
, PropertySheet.Reference , PropertySheet.Reference
) )
def build(self, business_configuration): def _build(self, business_configuration):
portal = self.getPortalObject() portal = self.getPortalObject()
business_process_id = \ business_process_id = \
business_configuration.getGlobalConfigurationAttr('business_process_id') business_configuration.getGlobalConfigurationAttr('business_process_id')
......
...@@ -56,7 +56,7 @@ class RoleConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -56,7 +56,7 @@ class RoleConfiguratorItem(ConfiguratorItemMixin, XMLObject):
, PropertySheet.CategoryCore , PropertySheet.CategoryCore
, PropertySheet.DublinCore ) , PropertySheet.DublinCore )
def build(self, business_configuration): def _build(self, business_configuration):
object_list = business_configuration.ConfigurationTemplate_readOOCalcFile(self.filename) object_list = business_configuration.ConfigurationTemplate_readOOCalcFile(self.filename)
portal = self.getPortalObject() portal = self.getPortalObject()
......
...@@ -54,7 +54,7 @@ class RuleConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -54,7 +54,7 @@ class RuleConfiguratorItem(ConfiguratorItemMixin, XMLObject):
, PropertySheet.CategoryCore , PropertySheet.CategoryCore
, PropertySheet.DublinCore ) , PropertySheet.DublinCore )
def build(self, business_configuration): def _build(self, business_configuration):
portal = self.getPortalObject() portal = self.getPortalObject()
simulation_rule_dict = portal.ERPSite_getConfiguratorSimulationRuleDict() simulation_rule_dict = portal.ERPSite_getConfiguratorSimulationRuleDict()
for key, value in simulation_rule_dict.iteritems(): for key, value in simulation_rule_dict.iteritems():
......
...@@ -57,7 +57,7 @@ class SaleTradeConditionConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -57,7 +57,7 @@ class SaleTradeConditionConfiguratorItem(ConfiguratorItemMixin, XMLObject):
, PropertySheet.Reference , PropertySheet.Reference
) )
def build(self, business_configuration): def _build(self, business_configuration):
portal = self.getPortalObject() portal = self.getPortalObject()
business_process_id = \ business_process_id = \
business_configuration.getGlobalConfigurationAttr('business_process_id') business_configuration.getGlobalConfigurationAttr('business_process_id')
......
...@@ -55,7 +55,7 @@ class ServiceConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -55,7 +55,7 @@ class ServiceConfiguratorItem(ConfiguratorItemMixin, XMLObject):
, PropertySheet.DublinCore , PropertySheet.DublinCore
, PropertySheet.ConfiguratorItem ) , PropertySheet.ConfiguratorItem )
def build(self, business_configuration): def _build(self, business_configuration):
portal = self.getPortalObject() portal = self.getPortalObject()
for service_id, service_title in iter(self.getConfigurationListList()): for service_id, service_title in iter(self.getConfigurationListList()):
document = getattr(portal.service_module, service_id, None) document = getattr(portal.service_module, service_id, None)
......
...@@ -55,7 +55,7 @@ class SitePropertyConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -55,7 +55,7 @@ class SitePropertyConfiguratorItem(ConfiguratorItemMixin, XMLObject):
, PropertySheet.DublinCore , PropertySheet.DublinCore
, PropertySheet.ConfiguratorItem ) , PropertySheet.ConfiguratorItem )
def build(self, business_configuration): def _build(self, business_configuration):
portal = self.getPortalObject() portal = self.getPortalObject()
id_list = [] id_list = []
for id, value, prop_type in self.getConfigurationList(): for id, value, prop_type in self.getConfigurationList():
......
...@@ -54,7 +54,7 @@ class SolverConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -54,7 +54,7 @@ class SolverConfiguratorItem(ConfiguratorItemMixin, XMLObject):
, PropertySheet.CategoryCore , PropertySheet.CategoryCore
, PropertySheet.DublinCore ) , PropertySheet.DublinCore )
def build(self, business_configuration): def _build(self, business_configuration):
portal = self.getPortalObject() portal = self.getPortalObject()
solver = getattr(portal.portal_solvers, self.getId(), None) solver = getattr(portal.portal_solvers, self.getId(), None)
......
...@@ -59,7 +59,7 @@ class StandardBT5ConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -59,7 +59,7 @@ class StandardBT5ConfiguratorItem(ConfiguratorItemMixin, XMLObject):
, PropertySheet.StandardBT5ConfiguratorItem , PropertySheet.StandardBT5ConfiguratorItem
) )
def build(self, business_configuration): def _build(self, business_configuration):
bt5_id = self.getBt5Id() bt5_id = self.getBt5Id()
portal = self.getPortalObject() portal = self.getPortalObject()
template_tool = getToolByName(portal, 'portal_templates') template_tool = getToolByName(portal, 'portal_templates')
......
...@@ -94,7 +94,7 @@ class SystemPreferenceConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -94,7 +94,7 @@ class SystemPreferenceConfiguratorItem(ConfiguratorItemMixin, XMLObject):
) )
def build(self, business_configuration): def _build(self, business_configuration):
portal = self.getPortalObject() portal = self.getPortalObject()
portal_preferences = portal.portal_preferences portal_preferences = portal.portal_preferences
preference = portal_preferences._getOb(self.object_id, None) preference = portal_preferences._getOb(self.object_id, None)
......
...@@ -54,7 +54,7 @@ class WorkflowSecurityConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -54,7 +54,7 @@ class WorkflowSecurityConfiguratorItem(ConfiguratorItemMixin, XMLObject):
, PropertySheet.CategoryCore , PropertySheet.CategoryCore
, PropertySheet.DublinCore ) , PropertySheet.DublinCore )
def build(self, business_configuration): def _build(self, business_configuration):
## NOT TESTED ## NOT TESTED
return return
table_dict = business_configuration.ConfigurationTemplate_readOOCalcFile(self.filename) table_dict = business_configuration.ConfigurationTemplate_readOOCalcFile(self.filename)
......
...@@ -36,7 +36,7 @@ class IConfiguratorItem(Interface): ...@@ -36,7 +36,7 @@ class IConfiguratorItem(Interface):
can be used to build an ERP5 Configuration Save. can be used to build an ERP5 Configuration Save.
""" """
def build(business_configuration): def _build(business_configuration):
""" """
Build new ERP5 Documents based on stored parameters during Build new ERP5 Documents based on stored parameters during
the configuraton process. the configuraton process.
......
...@@ -53,13 +53,13 @@ class ConfiguratorItemMixin: ...@@ -53,13 +53,13 @@ class ConfiguratorItemMixin:
current_template_path_list.extend(relative_url_list) current_template_path_list.extend(relative_url_list)
bt5_obj.edit(template_path_list=current_template_path_list) bt5_obj.edit(template_path_list=current_template_path_list)
def buildItem(self, business_configuration_relative_url): def build(self, business_configuration_relative_url):
""" Invoke build process """ """ Invoke build process """
business_configuration = self.getPortalObject().restrictedTraverse(\ business_configuration = self.getPortalObject().restrictedTraverse(\
business_configuration_relative_url) business_configuration_relative_url)
LOG('CONFIGURATOR', INFO, 'Building --> %s' % self) LOG('CONFIGURATOR', INFO, 'Building --> %s' % self)
start_build = time.time() start_build = time.time()
result = self.build(business_configuration) result = self._build(business_configuration)
LOG('CONFIGURATOR', INFO, 'Built --> %s (%.02fs)' % (self, LOG('CONFIGURATOR', INFO, 'Built --> %s (%.02fs)' % (self,
time.time()-start_build)) time.time()-start_build))
return result return result
......
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