[CMF-checkins] CVS: Products/CMFCore - ActionsTool.py:1.14

Jens Vagelpohl jens@zope.com
Thu, 27 Sep 2001 11:30:52 -0400


Update of /cvs-repository/Products/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv31158/CMFCore

Modified Files:
	ActionsTool.py 
Log Message:
Added API to...

- list existing action providers
- add a new action provider
- delete an existing action provider




=== Products/CMFCore/ActionsTool.py 1.13 => 1.14 ===
     manage_overview = DTMLFile( 'explainActionsTool', _dtmldir )
 
+
+    #
+    # Programmatically manipulate the list of action providers
+    #
+
+    security.declareProtected( CMFCorePermissions.ManagePortal
+                             , 'listActionProviders'
+                             )
+    def listActionProviders( self ):
+       """ returns a sequence of action providers known by this tool """
+       return self.action_providers
+
+    security.declareProtected( CMFCorePermissions.ManagePortal
+                             , 'addActionProvider'
+                             )
+    def addActionProvider( self, provider_name ):
+        """ add the name of a new action provider """
+        if hasattr( self, provider_name ):
+            p_old = self.action_providers
+            p_new = p_old + ( provider_name, )
+            self.action_providers = p_new
+
+    security.declareProtected( CMFCorePermissions.ManagePortal
+                             , 'deleteActionProvider'
+                             )
+    def deleteActionProvider( self, provider_name ):
+        """ remove an action provider """
+        if provider_name in self.action_providers:
+            p_old = list( self.action_providers )
+            del p_old[p_old.index( provider_name)]
+            self.action_providers = tuple( p_old )
+
     #
     #   'portal_actions' interface methods
     #