[Erp5-report] r29857 - in /erp5/trunk/products/ERP5: Document/BusinessTemplate.py ERP5Site.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Oct 20 16:51:06 CEST 2009


Author: seb
Date: Tue Oct 20 16:51:02 2009
New Revision: 29857

URL: http://svn.erp5.org?rev=29857&view=rev
Log:
* 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

Modified:
    erp5/trunk/products/ERP5/Document/BusinessTemplate.py
    erp5/trunk/products/ERP5/ERP5Site.py

Modified: erp5/trunk/products/ERP5/Document/BusinessTemplate.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BusinessTemplate.py?rev=29857&r1=29856&r2=29857&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BusinessTemplate.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BusinessTemplate.py [utf8] Tue Oct 20 16:51:02 2009
@@ -904,7 +904,15 @@
           # 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

Modified: erp5/trunk/products/ERP5/ERP5Site.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/ERP5Site.py?rev=29857&r1=29856&r2=29857&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/ERP5Site.py [utf8] (original)
+++ erp5/trunk/products/ERP5/ERP5Site.py [utf8] Tue Oct 20 16:51:02 2009
@@ -1451,6 +1451,19 @@
           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 @@
     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 @@
       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 @@
       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




More information about the Erp5-report mailing list