From ff86adcc4d57713a5327124366907c91475e641e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com>
Date: Thu, 6 Sep 2007 14:50:47 +0000
Subject: [PATCH] use and propagate reindex_kw

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16125 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/Core/Folder.py | 7 ++++++-
 product/ERP5Type/Utils.py       | 4 +++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/product/ERP5Type/Core/Folder.py b/product/ERP5Type/Core/Folder.py
index f8b9302667..d6cff30685 100644
--- a/product/ERP5Type/Core/Folder.py
+++ b/product/ERP5Type/Core/Folder.py
@@ -77,7 +77,7 @@ class FolderMixIn(ExtensionClass.Base):
   def newContent(self, id=None, portal_type=None, id_group=None,
           default=None, method=None, immediate_reindex=0,
           container=None, created_by_builder=0, activate_kw=None,
-          is_indexable=None, temp_object=0, **kw):
+          is_indexable=None, temp_object=0, reindex_kw=None, **kw):
     """Creates a new content.
     This method is public, since TypeInformation.constructInstance will perform
     the security check.
@@ -113,6 +113,7 @@ class FolderMixIn(ExtensionClass.Base):
                            id=new_id,
                            created_by_builder=created_by_builder,
                            activate_kw=activate_kw,
+                           reindex_kw=reindex_kw,
                            is_indexable=is_indexable
                            ) # **kw) removed due to CMF bug
       # TODO :the **kw makes it impossible to create content not based on
@@ -589,6 +590,10 @@ class Folder( CopyContainer, CMFBTreeFolder, Base, FolderMixIn, WebDAVFolder):
       if activate_kw is None:
         activate_kw = {}
 
+      reindex_kw = self.getDefaultReindexParametersDict()
+      if reindex_kw is not None:
+        kw.update(reindex_kw)
+
       group_id_list  = []
       if kw.get("group_id", "") not in ('', None):
         group_id_list.append(kw.get("group_id", ""))
diff --git a/product/ERP5Type/Utils.py b/product/ERP5Type/Utils.py
index a8d0e34be6..df317185a4 100644
--- a/product/ERP5Type/Utils.py
+++ b/product/ERP5Type/Utils.py
@@ -330,10 +330,12 @@ class DocumentConstructor(Method):
       self.klass = klass
 
     def __call__(self, folder, id, REQUEST=None,
-                 activate_kw=None, is_indexable=None, **kw):
+                 activate_kw=None, is_indexable=None, reindex_kw=None, **kw):
       o = self.klass(id)
       if activate_kw is not None:
         o.__of__(folder).setDefaultActivateParameters(**activate_kw)
+      if reindex_kw is not None:
+        o.__of__(folder).setDefaultReindexParameters(**reindex_kw)        
       if is_indexable is not None:
         o.isIndexable = is_indexable
       folder._setObject(id, o)
-- 
2.30.9