From 6876430f9d26e6a88a3c63ef2697da630c4aeced Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Thu, 27 Mar 2008 18:04:30 +0000
Subject: [PATCH] * reindex after setting category_list in CMFCategory.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20182 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/CMFCategory/CategoryTool.py | 11 ++++++++---
 product/ERP5Type/Base.py            |  3 +--
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/product/CMFCategory/CategoryTool.py b/product/CMFCategory/CategoryTool.py
index 6e9834c1bc..e91a9a8564 100644
--- a/product/CMFCategory/CategoryTool.py
+++ b/product/CMFCategory/CategoryTool.py
@@ -702,7 +702,7 @@ class CategoryTool( UniqueObject, Folder, Base ):
 #           'new_category_list: %s' % str(new_category_list))
 #       LOG("CategoryTool, setCategoryMembership", 0 ,
 #           'default_new_category_list: %s' % str(default_new_category_list))
-      self._setCategoryList(context, tuple(default_new_category_list + new_category_list))
+      self.setCategoryList(context, tuple(default_new_category_list + new_category_list))
 
 
     security.declareProtected( Permissions.AccessContentsInformation, 'setDefaultCategoryMembership' )
@@ -1214,6 +1214,11 @@ class CategoryTool( UniqueObject, Folder, Base ):
           result.append(context.getRelativeUrl()) # Pure category is member of itself
       return result
 
+    security.declareProtected( Permissions.ModifyPortalContent, 'setCategoryList' )
+    def setCategoryList(self, context, value):
+       self._setCategoryList(context, value)
+       context.reindexObject()
+
     security.declareProtected( Permissions.ModifyPortalContent, '_setCategoryList' )
     def _setCategoryList(self, context, value):
        context.categories = tuple(value)
@@ -1253,7 +1258,7 @@ class CategoryTool( UniqueObject, Folder, Base ):
             append(cat)
           else:
             requires_update = 1
-      if requires_update: self._setCategoryList(context, tuple(categories))
+      if requires_update: self.setCategoryList(context, tuple(categories))
 
     # Catalog related methods
     def updateRelatedCategory(self, category, previous_category_url, new_category_url):
@@ -1288,7 +1293,7 @@ class CategoryTool( UniqueObject, Folder, Base ):
                                                       previous_category_url,
                                                       new_category_url)
             category_list.append(new_category)
-          self._setCategoryList(o, category_list)
+          self.setCategoryList(o, category_list)
 
           if getattr(aq_base(o),
                     'notifyAfterUpdateRelatedContent', None) is not None:
diff --git a/product/ERP5Type/Base.py b/product/ERP5Type/Base.py
index 47148d0e10..b369dc402f 100644
--- a/product/ERP5Type/Base.py
+++ b/product/ERP5Type/Base.py
@@ -2292,8 +2292,7 @@ class Base( CopyContainer,
 
   security.declareProtected( Permissions.ModifyPortalContent, 'setCategoryList' )
   def setCategoryList(self, path_list):
-    self._setCategoryList(path_list)
-    self.reindexObject()
+    self.portal_categories.setCategoryList(self, path_list)
 
   security.declareProtected( Permissions.ModifyPortalContent, '_setCategoryList' )
   def _setCategoryList(self, path_list):
-- 
2.30.9