[CMF-checkins] CVS: CMF/CMFCore - ActionInformation.py:1.10.2.2 ActionProviderBase.py:1.13.6.2 ActionsTool.py:1.31.2.2

Chris McDonough chrism@zope.com
Wed, 31 Jul 2002 13:19:11 -0400


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

Modified Files:
      Tag: chrism-actions-branch
	ActionInformation.py ActionProviderBase.py ActionsTool.py 
Log Message:
ActionInformation objects no longer have a positional id argument.


=== CMF/CMFCore/ActionInformation.py 1.10.2.1 => 1.10.2.2 ===
     security = ClassSecurityInfo()
     _action_info = None
 
-    def __init__( self, id, **kw):
-        """ Set up an instance.
-        """
-        kw['id'] = id
+    def __init__( self, **kw):
+        """ """
+        if not kw.has_key('id'):
+            raise ValueError, 'argument must include id'
         self.updateActionInfoDict(kw)
 
     security.declareProtected( View, 'Title' )
@@ -143,9 +143,7 @@
         """ Return a newly-created AI just like us.
         """
         kw = self._action_info.copy()
-        id = kw['id']
-        del kw['id']
-        return apply(self.__class__, (id,), kw)
+        return apply(self.__class__, (), kw)
 
     security.declarePrivate('getActionInfo')
     def getActionInfoDict( self ):


=== CMF/CMFCore/ActionProviderBase.py 1.13.6.1 => 1.13.6.2 ===
         if type( permission ) != type( () ):
             permission = permission and (str(permission),) or ()
 
-        new_actions = self._cloneActions()
-
-        new_action = ActionInformation( id=str(id)
-                                      , title=str(name)
-                                      , action=a_expr
-                                      , condition=c_expr
-                                      , permissions=permission
-                                      , category=str(category)
-                                      , visible=int(visible)
-                                      )
-
-        new_actions.append( new_action )
-        self._actions = tuple( new_actions )
+        self._addAction( id=str(id)
+                         , title=str(name)
+                         , action=a_expr
+                         , condition=c_expr
+                         , permissions=permission
+                         , category=str(category)
+                         , visible=int(visible)
+                         )
 
         if REQUEST is not None:
             return self.manage_editActionsForm(
                 REQUEST, manage_tabs_message='Added.')
+
+    def _addAction(self, **kw):
+        """ Adds an action with the key-value pairs in kw as its
+        elements """
+        new_actions = self._cloneActions()
+        new_action = apply(ActionInformation, (), kw)
+        new_actions.append( new_action )
+        self._actions = tuple( new_actions )
 
     security.declareProtected( ManagePortal, 'changeActions' )
     def changeActions( self, properties=None, REQUEST=None ):


=== CMF/CMFCore/ActionsTool.py 1.31.2.1 => 1.31.2.2 ===