[Zope-CMF] Re: Proposal: Add 'changeAction' method to
ActionProviderBase.ActionProviderBase
yuppie
y.2004_ at wcm-solutions.de
Fri Jun 25 03:44:43 EDT 2004
Hi Grégoire!
Gregoire Weber wrote:
> I'd like to add the below changeAction method to ActionProviderBase.
> Any Objections?
> Can I put that into the branch for CMF 1.5? Is it the head?
> I'd really like to have it in the upcoming CMF 1.5 if possible.
[...]
> security.declareProtected( ManagePortal, 'changeAction' )
> def changeAction( self
> , id
> , new_id=_unchanged
> , title=_unchanged
> , description=_unchanged
> , category=_unchanged
> , condition=_unchanged
> , permissions=_unchanged
> , priority=_unchanged
> , visible=_unchanged
> , action=_unchanged
> ):
> """Changes the specified properties of the action with id 'id'.
> """
> # get the action beeing changed
> action_ids = [a.getId() for a in self._actions]
> pos = action_ids.index(id)
> current = actions[pos]
1.) This will not work because Action ids aren't unique. We discussed
that months ago on this list and the result was:
Actions are identified by their 'path', a combination of category and
id. Using duplicate paths per Action Provider is deprecated, API methods
might just take the first Action with the given path. After CMF 1.5
unique paths might be enforced.
listActionInfos and getActionInfo use paths like 'global/foo', see their
implementation for details. Note that '/' is allowed in categories, so
'global/baz/foo' should resolve to category 'global/baz' and id 'foo'.
2.) I think ActionInformation should have an edit method, so instead of
action_provider.changeAction('global/foo', title='Foo Title')
I'd prefer this, using a new getActionObject method:
action_provider.getActionObject('global/foo').edit(title='Foo Title')
I hope some day Actions will be accessible directly:
action_provider.Actions.global.foo.edit(title='Foo Title')
3.) Just for the records: this is <http://collector.zope.org/CMF/195>
Cheers,
Yuppie
More information about the Zope-CMF
mailing list