Commit 6876430f authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

* reindex after setting category_list in CMFCategory.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20182 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent aec6a9de
...@@ -702,7 +702,7 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -702,7 +702,7 @@ class CategoryTool( UniqueObject, Folder, Base ):
# 'new_category_list: %s' % str(new_category_list)) # 'new_category_list: %s' % str(new_category_list))
# LOG("CategoryTool, setCategoryMembership", 0 , # LOG("CategoryTool, setCategoryMembership", 0 ,
# 'default_new_category_list: %s' % str(default_new_category_list)) # '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' ) security.declareProtected( Permissions.AccessContentsInformation, 'setDefaultCategoryMembership' )
...@@ -1214,6 +1214,11 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -1214,6 +1214,11 @@ class CategoryTool( UniqueObject, Folder, Base ):
result.append(context.getRelativeUrl()) # Pure category is member of itself result.append(context.getRelativeUrl()) # Pure category is member of itself
return result return result
security.declareProtected( Permissions.ModifyPortalContent, 'setCategoryList' )
def setCategoryList(self, context, value):
self._setCategoryList(context, value)
context.reindexObject()
security.declareProtected( Permissions.ModifyPortalContent, '_setCategoryList' ) security.declareProtected( Permissions.ModifyPortalContent, '_setCategoryList' )
def _setCategoryList(self, context, value): def _setCategoryList(self, context, value):
context.categories = tuple(value) context.categories = tuple(value)
...@@ -1253,7 +1258,7 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -1253,7 +1258,7 @@ class CategoryTool( UniqueObject, Folder, Base ):
append(cat) append(cat)
else: else:
requires_update = 1 requires_update = 1
if requires_update: self._setCategoryList(context, tuple(categories)) if requires_update: self.setCategoryList(context, tuple(categories))
# Catalog related methods # Catalog related methods
def updateRelatedCategory(self, category, previous_category_url, new_category_url): def updateRelatedCategory(self, category, previous_category_url, new_category_url):
...@@ -1288,7 +1293,7 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -1288,7 +1293,7 @@ class CategoryTool( UniqueObject, Folder, Base ):
previous_category_url, previous_category_url,
new_category_url) new_category_url)
category_list.append(new_category) category_list.append(new_category)
self._setCategoryList(o, category_list) self.setCategoryList(o, category_list)
if getattr(aq_base(o), if getattr(aq_base(o),
'notifyAfterUpdateRelatedContent', None) is not None: 'notifyAfterUpdateRelatedContent', None) is not None:
......
...@@ -2292,8 +2292,7 @@ class Base( CopyContainer, ...@@ -2292,8 +2292,7 @@ class Base( CopyContainer,
security.declareProtected( Permissions.ModifyPortalContent, 'setCategoryList' ) security.declareProtected( Permissions.ModifyPortalContent, 'setCategoryList' )
def setCategoryList(self, path_list): def setCategoryList(self, path_list):
self._setCategoryList(path_list) self.portal_categories.setCategoryList(self, path_list)
self.reindexObject()
security.declareProtected( Permissions.ModifyPortalContent, '_setCategoryList' ) security.declareProtected( Permissions.ModifyPortalContent, '_setCategoryList' )
def _setCategoryList(self, path_list): def _setCategoryList(self, path_list):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment