[Zope-CMF] Programmatically manipulating actions on a TypeInfo object

alan runyan alan runyan" <runyaga@runyaga.com
Wed, 29 May 2002 14:57:38 -0500


> I'm trying to programmatically set the action field of an action in a
> TypeInformation object (in an external method). I've tried a few tacks
> on this and can't work it out. In particular, if I try to get hold of
> the action from a TypeInformation object and assign to the _action
> field:
>
>     view_action = typeObj.getActionById('view')
>     view_action._action = "links_view"

this is a no no.  grab the object's type instance from portal_types and
create a new _actions.
NOTE portal_type._actions are LISTS.  in all other tools they are tuples.
(I could be backwards ;)

if you have plone around you can look at CMFPlone/Extensions/Update.py -- I
believe it has something in there
that may help.  portal_type[object.getTypeInfo().getId()]._actions is
different from portal_membership._actions
in quite a few ways.  I believe we should reconcile these differences.  I
think I could do it.  any reason we shouldnt
have actions acting the same way throughout the entire system?

~runyaga