[Zope-CMF] [dev] enhancing Actions: proposal details

yuppie y.2005- at wcm-solutions.de
Thu Jan 13 07:16:34 EST 2005


Hi!


This is a follow up to the "rough proposal" I made 2 months ago. Based 
on the discussion I try to give some additional details and propose to 
implement these parts of the original proposal:


Scope:
======

- This is about how Actions are set in Action providers and the Actions 
tool. The way Actions are used in the skins doesn't change.

- The proposed changes are meant as a first step. Introducing these 
changes in the early stage of CMF 1.6 allows people to make themselves 
familiar with the new ActionCategory and Action objects and to 
experiment with advanced use cases. In the long run they should replace 
the old ActionInformation objects completely, but for now these new 
objects just provide an other way to set Actions.

- Modifying CMFDefault to use the new machinery for all "normal" Action 
providers. Changing type Actions and workflow Actions is not part of 
this proposal.

- Modifying CMFSetup to migrate "normal" Actions on import.


The proposed machinery:
=======================

The Actions tool will become folderish. You can add ActionCategory 
objects to the Actions tool and either subcategories or Action objects 
to categories.


class ActionCategory(Interface):
     """ Group of Action objects.
     """

     def listActions():
         """ List the actions defined in this category and its
         subcategories.

         Permission -- Python only

         Returns -- Tuple of Action objects.
         """

The default implementation of ActionCategory will subclass from 
OrderedFolder. Using IFAwareObjectManager allows to restrict subobjects 
to objects implementing ActionCategory or Action.


class Action(Interface):
     """ Reference to an action.
     """

     def getInfoData():
         """ Get the data needed to create an ActionInfo.

         Default keys are: 'id', 'category', 'title', 'description',
         'url', 'icon', 'available', 'permissions' and 'visible'.

         Instead of computed values callable expression objects or
         methods are returned. For performance reasons, these objects
         are called later and only if the values are actually needed.
         The keys for all these lazy values are registered in a
         separate list.

         Permission -- Python only

         Returns -- Lazy info mapping and list of lazy keys.
         """

The default implementation of Action will subclass from 
SimpleItemWithProperties. Expressions are stored as string properties 
with '_expr' suffix.



As always, questions and comments are welcome.

If there are no objections, I'll check in the proposed changes to CMF HEAD.


Cheers,

	Yuppie




More information about the Zope-CMF mailing list