From 897b48148be238f4172b89a054248724d8db3601 Mon Sep 17 00:00:00 2001 From: Sebastien Robin <seb@nexedi.com> Date: Tue, 20 Oct 2009 14:51:02 +0000 Subject: [PATCH] * Do not call ERP5Site_reindexAll any more when we install a site, this is useless * postpone the installation of some tools in order to make sure they will be indexed * manage_afterClone class reindexObjectSecurity that himself calls recursiveReindex, we do not want to recursive reindex when we install a new site, so we manually reindex objects (without recursive) when we install new object with bt, like this we remove duplicates of reindexing git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29857 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/BusinessTemplate.py | 8 ++++++++ product/ERP5/ERP5Site.py | 23 ++++++++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py index 314e09fa54..0c5480a7b9 100644 --- a/product/ERP5/Document/BusinessTemplate.py +++ b/product/ERP5/Document/BusinessTemplate.py @@ -904,7 +904,15 @@ class ObjectTemplateItem(BaseTemplateItem): # mark a business template installation so in 'PortalType_afterClone' scripts # we can implement logical for reseting or not attributes (i.e reference). self.REQUEST.set('is_business_template_installation', 1) + # We set isIndexable to 0 before calling + # manage_afterClone in order to not call recursiveReindex, this is + # useless because we will already reindex every created object, so + # we avoid duplication of reindexation + obj.isIndexable = 0 obj.manage_afterClone(obj) + del obj.isIndexable + if getattr(aq_base(obj), 'reindexObject', None) is not None: + obj.reindexObject() obj.wl_clearLocks() if portal_type_dict: # set workflow chain diff --git a/product/ERP5/ERP5Site.py b/product/ERP5/ERP5Site.py index e60076d322..4f42082aeb 100644 --- a/product/ERP5/ERP5Site.py +++ b/product/ERP5/ERP5Site.py @@ -1451,6 +1451,19 @@ class ERP5Generator(PortalGenerator): keep = 0 portal_activities.manageClearActivities(keep=keep) + # Add several other tools, only at the end in order + # to make sure that they will be reindexed + addTool = p.manage_addProduct['ERP5'].manage_addTool + if not p.hasObject('portal_rules'): + addTool('ERP5 Rule Tool', None) + if not p.hasObject('portal_simulation'): + addTool('ERP5 Simulation Tool', None) + if not p.hasObject('portal_deliveries'): + addTool('ERP5 Delivery Tool', None) + if not p.hasObject('portal_orders'): + addTool('ERP5 Order Tool', None) + + def setupTemplateTool(self, p, **kw): """ Setup the Template Tool. Security must be set strictly. @@ -1493,12 +1506,8 @@ class ERP5Generator(PortalGenerator): addTool = p.manage_addProduct['ERP5'].manage_addTool if not p.hasObject('portal_categories'): addTool('ERP5 Categories', None) - if not p.hasObject('portal_rules'): - addTool('ERP5 Rule Tool', None) if not p.hasObject('portal_ids'): addTool('ERP5 Id Tool', None) - if not p.hasObject('portal_simulation'): - addTool('ERP5 Simulation Tool', None) if not p.hasObject('portal_templates'): self.setupTemplateTool(p) if not p.hasObject('portal_trash'): @@ -1507,10 +1516,6 @@ class ERP5Generator(PortalGenerator): addTool('ERP5 Alarm Tool', None) if not p.hasObject('portal_domains'): addTool('ERP5 Domain Tool', None) - if not p.hasObject('portal_deliveries'): - addTool('ERP5 Delivery Tool', None) - if not p.hasObject('portal_orders'): - addTool('ERP5 Order Tool', None) if not p.hasObject('portal_tests'): addTool('ERP5 Test Tool', None) if not p.hasObject('portal_password'): @@ -1774,7 +1779,7 @@ class ERP5Generator(PortalGenerator): portal_catalog.getSQLCatalog().z0_drop_portal_ids() # Then clear the catalog and reindex it portal_catalog.manage_catalogClear() - skins_tool["erp5_core"].ERP5Site_reindexAll() + # Calling ERP5Site_reindexAll is useless. def setupUserFolder(self, p): # We use if possible ERP5Security, then NuxUserGroups -- 2.30.9