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

Tres Seaver tseaver@zope.com
Fri, 30 Aug 2002 10:44:27 -0400


Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv17577/CMFCore

Modified Files:
      Tag: CMF-1_3-branch
	ActionsTool.py 
Log Message:


 - Fixed bugs around 'addActionProvider' in ActionsTool (Collector #42).


=== CMF/CMFCore/ActionsTool.py 1.27.10.5 => 1.27.10.6 ===
--- CMF/CMFCore/ActionsTool.py:1.27.10.5	Fri Aug 30 10:31:06 2002
+++ CMF/CMFCore/ActionsTool.py	Fri Aug 30 10:44:27 2002
@@ -113,11 +113,9 @@
                 if item not in chosen:
                     new_providers.append(item)
             providers = new_providers
-        self.action_providers = providers
+        self.action_providers = tuple(providers)
         if REQUEST is not None:
-            return self.manage_actionProviders(
-                            self
-                          , REQUEST
+            return self.manage_actionProviders( self , REQUEST
                           , manage_tabs_message='Properties changed.')
 
     #
@@ -145,18 +143,20 @@
         """
         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
+        ap = list( self.action_providers )[:]
+        if hasattr( self, provider_name ) and provider_name not in ap:
+            ap.append( provider_name )
+            self.action_providers = tuple( ap )
 
     security.declareProtected( ManagePortal, 'deleteActionProvider' )
     def deleteActionProvider( self, provider_name ):
-        """ remove an action provider """
+        """
+        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 )
+            ap = list( self.action_providers )
+            ap.remove( provider_name )
+            self.action_providers = tuple( ap )
 
     #
     #   'portal_actions' interface methods