From 6520a3f030fb77d989d4a6235d255334ff0fd99e Mon Sep 17 00:00:00 2001 From: Romain Courteaud <romain@nexedi.com> Date: Mon, 18 Apr 2005 08:47:32 +0000 Subject: [PATCH] DeliveryTool can now content DeliveryBuilder. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2896 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Tool/DeliveryTool.py | 33 +++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/product/ERP5/Tool/DeliveryTool.py b/product/ERP5/Tool/DeliveryTool.py index ece6932951..9036eb9fec 100755 --- a/product/ERP5/Tool/DeliveryTool.py +++ b/product/ERP5/Tool/DeliveryTool.py @@ -30,6 +30,8 @@ from Products.CMFCore.utils import UniqueObject from AccessControl import ClassSecurityInfo from Globals import InitializeClass, DTMLFile +from Products.ERP5Type.Tool.BaseTool import BaseTool +from Products.CMFCore.PortalFolder import PortalFolder from Products.ERP5Type.Document.Folder import Folder from Products.ERP5Type import Permissions @@ -37,7 +39,7 @@ from Products.ERP5 import _dtmldir from zLOG import LOG -class DeliveryTool(UniqueObject, Folder): +class DeliveryTool(UniqueObject, Folder, BaseTool): """ The DeliveryTool implements portal object deliveries building policies. @@ -48,11 +50,32 @@ class DeliveryTool(UniqueObject, Folder): id = 'portal_deliveries' meta_type = 'ERP5 Delivery Tool' portal_type = 'Delivery Tool' - allowed_types = () + allowed_types = ('ERP5 Delivery Buider',) # Declarative Security security = ClassSecurityInfo() + # Filter content (ZMI)) + def filtered_meta_types(self, user=None): + # Filters the list of available meta types. + #all = CMFCategoryTool.inheritedAttribute('filtered_meta_types')(self) + meta_types = [] + for meta_type in self.all_meta_types(): + if meta_type['name'] in self.allowed_types: + meta_types.append(meta_type) + return meta_types + + # patch, so that we are able to add the BaseCategory + 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') + def hasContent(self,id): + return id in self.objectIds() # # ZMI methods # @@ -81,5 +104,11 @@ class DeliveryTool(UniqueObject, Folder): meta_types.append(meta_type) return meta_types + security.declareProtected(Permissions.ModifyPortalContent, 'tic') + def tic(self): + """ + We will look at all delivery builder and activate them. + """ + pass InitializeClass(DeliveryTool) -- 2.30.9