[Zope-CMF] TTW Actions Forthcoming
Andrew Sawyers
andrew@zope.com
Thu, 3 Jan 2002 11:43:37 -0500
This email is just to give a heads up to people regarding some changes to
tools in the CMF.
Prior to these changes, tools which provided actions were hardcoded in the
software, with no interfaces for managing them TTW. With the changes I've
implemented, all the tools shipped in the CMF now can be action providers
and TTW management of actions provided by each tool is supported. There is
also now the ability to modify action providers TTW via the ActionsTool,
making it less painfull to write your own tools and register them with the
ActionsTool.
Each tool derives from ActionProviderBase which provides for the interfaces
for managing the actions on a tool TTW. A tool's listActions method
previously returned actions as a list of dictionaries; which were hardcoded
in the method. Now, tools store a list of ActionInformation instances in
the _actions attribute. Two interesting items which are included in this
refactoring is that the action and a new condition field are stored as an
instance of an Expression; this allows for writing actions and conditions
TTW in TALES (i.e. string: ${portal_url}/some_form). The condition is a
new feature allowing for more precision when determing when an action should
be
displayed. The following is a sample of instantiating an ActionInformation
instance from within the ActionsTool:
_actions = [ActionInformation(id='folderContents'
, title='Folder contents'
, action=Expression(
text='string: ${folder_url}/folder_contents')
, condition=Expression(
text='python: folder is not object')
, permissions=('List folder contents',)
, category='object'
, visible=1
)]
I've included support for backwards compatability if you have customized a
tool or written your own tool in which listActions returns a list of
dictionaries. If you're currently writing a custom tool, you might want to
look at the new way this is going to be handled.
These new features will make it into the head soon; and I just wanted to let
people know so you have the chance to check them out of cvs if you'd like as
well as provide any feedback. See
http://cvs.zope.org/CMF/?only_with_tag=andrew_ttw_actions-branch for diffs
or
http://cvs.zope.org/CMF/CMF.tar.gz?tarball=1&only_with_tag=andrew_ttw_action
s-branch
to download the branch tarball.
Thanks,
Andrew Sawyers
--------------------------------
Andrew Sawyers <andrew@zope.com>
Software Engineer
Zope Corporation
--------------------------------