[CMF-checkins] CVS: Products/CMFCore - ActionProviderBase.py:1.3

Tres Seaver tseaver@zope.com
Mon, 14 Jan 2002 11:00:49 -0500


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

Modified Files:
	ActionProviderBase.py 
Log Message:


 - Fix non-persistence of actions borrowed from class.

 - Add unit tests for ActionProviderBase.


=== Products/CMFCore/ActionProviderBase.py 1.2 => 1.3 ===
         Adds an action to the list.
         """
-        al = self._actions 
+        al = self._actions[:]
         if not name:
             raise ValueError('A name is required.')
         if action:
@@ -128,8 +128,8 @@
         """
         if properties is None:
             properties = REQUEST
-        actions = []
-        for idx in range(len(self._actions)):
+        actions = self._actions[:]
+        for idx in range(len(actions)):
             s_idx = str(idx)
             action = {
                 'id': str(properties.get('id_' + s_idx, '')),
@@ -143,7 +143,7 @@
                 }
             if not action['name']:
                 raise ValueError('A name is required.')
-            a = self._actions[idx]
+            a = actions[idx]
             a.id = action['id']
             a.title = action['name']
             if action['action'] is not '':
@@ -157,6 +157,7 @@
             a.permissions = action['permissions']
             a.category = action['category']
             a.visible = action['visible']
+        self._actions = actions
         if REQUEST is not None:
             return self.manage_editActionsForm(REQUEST, manage_tabs_message=
                                                'Actions changed.')
@@ -166,7 +167,7 @@
         """
         Deletes actions.
         """
-        actions = list(self._actions)
+        actions = self._actions[:]
         sels = list(map(int, selections))  # Convert to a list of integers.
         sels.sort()
         sels.reverse()