[CMF-checkins] CVS: Products/CMFCore/interfaces - portal_actions.py:1.17

Yvo Schubbe y.2004_ at wcm-solutions.de
Mon Jul 26 06:13:44 EDT 2004


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

Modified Files:
	portal_actions.py 
Log Message:
- merged yuppie-apb-redo-branch:

      o Removed again OldstyleActionProvider Interface and
        OldstyleActionProviderBase that existed only in 1.5.0-alpha.
        ActionProvider now also works with oldstyle Action mappings.

      o listActionInfos() and getActionInfo() now return ActionInfo objects
        instead of Action info mappings. ActionInfo objects have a backwards
        compatible mapping interface.

(hope there are no issues with this checkin, I'll be AFK the next 4 days)


=== Products/CMFCore/interfaces/portal_actions.py 1.16 => 1.17 ===
--- Products/CMFCore/interfaces/portal_actions.py:1.16	Wed Jun 30 11:40:17 2004
+++ Products/CMFCore/interfaces/portal_actions.py	Mon Jul 26 06:13:14 2004
@@ -57,22 +57,12 @@
     def listFilteredActionsFor(object=None):
         """ List all actions available to the user.
 
-        Each action has the following keys:
-
-        - name: An identifying action name
-
-        - url: The URL to visit to access the action
-
-        - permissions: A list. The user must have at least one of the listed
-          permissions to access the action. If the list is empty, the user is
-          allowed. (Note that listFilteredActionsFor() filters out actions
-          according to this field.)
-
-        - category: One of "user", "folder", "object", "global" or "workflow"
+        See the ActionInfo interface for provided keys. 'visible', 'available'
+        and 'allowed' are always True in actions returned by this method.
 
         Permission -- Always available
 
-        Returns -- Dictionary of category / action list pairs.
+        Returns -- Dictionary of category / ActionInfo list pairs
         """
 
     def listFilteredActions(object=None):
@@ -93,7 +83,7 @@
         version. If 'object' isn't specified, the method uses for backwards
         compatibility 'info.content' as object.
 
-        Returns -- Tuple of ActionInformation objects
+        Returns -- Tuple of ActionInformation objects (or Action mappings)
         """
 
     def getActionObject(action):
@@ -110,7 +100,7 @@
 
     def listActionInfos(action_chain=None, object=None, check_visibility=1,
                         check_permissions=1, check_condition=1, max=-1):
-        """ List Action info mappings.
+        """ List ActionInfo objects.
 
         'action_chain' is a sequence of action 'paths' (e.g. 'object/view').
         If specified, only these actions will be returned in the given order.
@@ -121,46 +111,44 @@
 
         Permission -- Always available (not publishable)
 
-        Returns -- Tuple of Action info mappings
+        Returns -- Tuple of ActionInfo objects
         """
 
     def getActionInfo(action_chain, object=None, check_visibility=0,
                       check_condition=0):
-        """ Get an Action info mapping specified by a chain of actions.
+        """ Get an ActionInfo object specified by a chain of actions.
 
         Permission -- Always available
 
-        Returns -- Action info mapping
+        Returns -- ActionInfo object
         """
 
 
-class OldstyleActionProvider(ActionProvider):
-    """ Deprecated interface expected of an object that can provide actions.
-
-    Still used by 'Oldstyle CMF Discussion Tool' and 'CMF Workflow Tool'.
-    """
+class ActionInfo(Interface):
+    """ A lazy dictionary for Action infos.
 
-    def listActions(info):
-        """ List all the actions defined by a provider.
+    Each ActionInfo object has the following keys:
 
-        Each action should contain the keys "name", "url", "permissions" and
-        "category", conforming to the specs outlined in
-        portal_actions.listFilteredActionsFor(). The info argument contains
-        at least the following attributes, some of which may be set to "None":
+      - id (string): not unique identifier
 
-        - isAnonymous
+      - title (string)
 
-        - portal
+      - url (string): URL to access the action
 
-        - portal_url
+      - category (string): one of "user", "folder", "object", "global",
+        "workflow" or a custom category
 
-        - folder
+      - visible (boolean)
 
-        - folder_url
+      - available (boolean): the result of checking the condition
 
-        - content
+      - allowed (boolean): the result of checking permissions
 
-        - content_url
+    Deprecated keys:
+        
+      - name (string): use 'id' or 'title' instead
 
-        Returns -- Tuple of mappings describing actions
-        """
+      - permissions (tuple): use 'allowed' instead; The user must have at
+        least one of the listed permissions to access the action. If the list
+        is empty, the user is allowed.
+    """



More information about the CMF-checkins mailing list