[Zope-CMF] Patch for more forward-compatible APB

Tres Seaver tseaver@zope.com
18 Apr 2003 14:17:51 -0400


On Fri, 2003-04-18 at 13:59, Sidnei da Silva wrote:
> | First, I presume that this code is actually manipulating the type
> | information objects' actions, rather than the tool actions;  the tool
> | actions have not been dictionaries ever, I think.  
> 
> Youre right. I was typing off from the top of my head.
> 
> | Second,
> | this is specifically the kind of usage I'd like to suppress:  it is
> | subverting the TIs own handling of actions.  I *especially* dislike the
> | last line there:  it breaks encapsulation at least two ways (the name of
> | the attribute, plus its representation as a tuple).
> 
> I agree on your point, but I dont remember APB having a method that
> you can pass in a set of actions to be set on the tool. Perhaps the
> solution would be adding more methods on APB to manipulate actions.

Because the APB actions are objects, of type ActionInformation, it
should be possible to add methods to them for setting the attributes you
care about.  We would likely make them private, e.g.::

    security.declarePrivate( '_setActionExpression' )
    def _setActionExpression( self, action ):
        
        if action and type( action ) == type( '' ):
            action = Expression( action )

        self.action = action

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com