From e513c76ec972888a685a54ec03e93006c40ba24f Mon Sep 17 00:00:00 2001
From: Sebastien Robin <seb@nexedi.com>
Date: Mon, 28 Jun 2004 14:43:06 +0000
Subject: [PATCH] added  fastRecursiveImmediateReindexObject

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1097 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/Document/Folder.py | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/product/ERP5Type/Document/Folder.py b/product/ERP5Type/Document/Folder.py
index 6842cfbcd1..1c1086c17f 100755
--- a/product/ERP5Type/Document/Folder.py
+++ b/product/ERP5Type/Document/Folder.py
@@ -460,6 +460,28 @@ be a problem)."""
         if hasattr(aq_base(c), 'recursiveImmediateReindexObject'):
           c.recursiveImmediateReindexObject()
 
+  security.declarePublic( 'fastRecursiveImmediateReindexObject' )
+  def fastRecursiveImmediateReindexObject(self):
+      """
+        Applies immediateReindexObject on self, and on subobjects
+
+        This method is mainly used when we paste objects, because
+        this is too long to wait for recursiveImmediateReindexObject,
+        and immediateReindexObject does not index sub-object.
+
+        So here we reindex sub-object but not sub-sub-objects.
+      """
+      # Reindex self
+      self.flushActivity(invoke = 0, method_id='immediateReindexObject') # This might create a recursive lock
+      self.flushActivity(invoke = 0, method_id='recursiveImmediateReindexObject') # This might create a recursive lock
+      if self.isIndexable:
+        self.immediateReindexObject()
+      # Reindex contents
+      for c in self.objectValues():
+        if hasattr(aq_base(c), 'immediateReindexObject'):
+          c.immediateReindexObject()
+      self.recursiveReindexObject()
+
   security.declareProtected( Permissions.ModifyPortalContent, 'recursiveMoveObject' )
   def recursiveMoveObject(self):
     """
-- 
2.30.9