[CMF-checkins] CVS: Products/CMFCore - ActionsTool.py:1.12 TypesTool.py:1.18

Tres Seaver tseaver@digicool.com
Mon, 6 Aug 2001 14:16:20 -0400


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

Modified Files:
	ActionsTool.py TypesTool.py 
Log Message:


 - Add 'visible' attribute to actions, to permit indirection (via
   'getActionById') without exposing the action in the CMF UI.


=== Products/CMFCore/ActionsTool.py 1.11 => 1.12 ===
                             'permissions': d['permissions'],
                             'category': d.get('category', 'object'),
+                            'visible': d.get('visible', 1),
                             })
             if hasattr(base, 'listActions'):
                 a = object.listActions(info)
@@ -229,6 +230,9 @@
         for action in actions:
             category = action['category']
             permissions = action.get('permissions', None)
+            visible = action.get('visible', 1)
+            if not visible:
+                continue
             verified = 0
             if not permissions:
                 # This action requires no extra permissions.


=== Products/CMFCore/TypesTool.py 1.17 => 1.18 ===
             if not a.has_key('id'):
                 a['id'] = string.lower(a['name'])
+            if not a.has_key( 'visible' ):
+                a['visible'] = 1
             actions.append(a)
         # possible_permissions is in AccessControl.Role.RoleManager.
         pp = self.possible_permissions()
@@ -302,7 +304,15 @@
                                   manage_tabs_message=manage_tabs_message)
 
     security.declareProtected(ManagePortal, 'addAction')
-    def addAction(self, id, name, action, permission, category, REQUEST=None):
+    def addAction( self
+                 , id
+                 , name
+                 , action
+                 , permission
+                 , category
+                 , visible=1
+                 , REQUEST=None
+                 ):
         """
         Adds an action to the list.
         """
@@ -314,6 +324,7 @@
              'action': str(action),
              'permissions': (str(permission),),
              'category': str(category),
+             'visible': int(visible),
              },)
         if REQUEST is not None:
             return self.manage_editActionsForm(
@@ -336,6 +347,7 @@
                 'permissions':
                 (properties.get('permission_' + s_idx, ()),),
                 'category': str(properties.get('category_' + s_idx, '')),
+                'visible': not not properties.get('visible_' + s_idx, 0),
                 }
             if not action['name']:
                 raise ValueError('A name is required.')