Commit b616073d authored by Sebastien Robin's avatar Sebastien Robin

make sure we are able to rename a base category


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2270 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b4fee3dc
...@@ -37,10 +37,11 @@ from AccessControl import ClassSecurityInfo ...@@ -37,10 +37,11 @@ from AccessControl import ClassSecurityInfo
from Globals import InitializeClass, DTMLFile, PersistentMapping from Globals import InitializeClass, DTMLFile, PersistentMapping
from OFS.Folder import Folder as OFS_Folder from OFS.Folder import Folder as OFS_Folder
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from Products.CMFCore.PortalFolder import PortalFolder
from zLOG import LOG from zLOG import LOG
class CategoryTool( CMFCategoryTool, BaseTool ): class CategoryTool(CMFCategoryTool, BaseTool):
""" """
The CategoryTool object is the placeholder for all methods The CategoryTool object is the placeholder for all methods
and algorithms related to categories and relations in ERP5. and algorithms related to categories and relations in ERP5.
...@@ -57,7 +58,8 @@ class CategoryTool( CMFCategoryTool, BaseTool ): ...@@ -57,7 +58,8 @@ class CategoryTool( CMFCategoryTool, BaseTool ):
# Filter content (ZMI)) # Filter content (ZMI))
def filtered_meta_types(self, user=None): def filtered_meta_types(self, user=None):
# Filters the list of available meta types. # Filters the list of available meta types.
all = CategoryTool.inheritedAttribute('filtered_meta_types')(self) #all = CMFCategoryTool.inheritedAttribute('filtered_meta_types')(self)
LOG('CategoryTool.filtered_meta_types',0,CategoryTool.all_meta_types())
meta_types = [] meta_types = []
for meta_type in self.all_meta_types(): for meta_type in self.all_meta_types():
if meta_type['name'] in self.allowed_types: if meta_type['name'] in self.allowed_types:
...@@ -67,6 +69,11 @@ class CategoryTool( CMFCategoryTool, BaseTool ): ...@@ -67,6 +69,11 @@ class CategoryTool( CMFCategoryTool, BaseTool ):
# patch, so that we are able to add the BaseCategory # patch, so that we are able to add the BaseCategory
allowedContentTypes = BaseTool.allowedContentTypes allowedContentTypes = BaseTool.allowedContentTypes
# patch, so that we are able to rename base categories
_verifyObjectPaste = PortalFolder._verifyObjectPaste
all_meta_types = BaseTool.all_meta_types
security.declareProtected(Permissions.View, 'hasContent') security.declareProtected(Permissions.View, 'hasContent')
def hasContent(self,id): def hasContent(self,id):
return id in self.objectIds() return id in self.objectIds()
...@@ -113,3 +120,6 @@ class CategoryTool( CMFCategoryTool, BaseTool ): ...@@ -113,3 +120,6 @@ class CategoryTool( CMFCategoryTool, BaseTool ):
getUids = getCategoryParentUidList getUids = getCategoryParentUidList
InitializeClass( CategoryTool ) InitializeClass( CategoryTool )
#from Products.ERP5Type.Utils import monkeyPatch
#monkeyPatch(CMFCategoryTool,CategoryTool,exclude_list=['__init__'])
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