[Zope-dev] ZPatterns -- trigger add events not working

Phillip J. Eby pje@telecommunity.com
Wed, 12 Jul 2000 11:30:32 -0500


It could cause a problem if the object is added after any other sort of
change from the point of view of the Agent.  The Agent would view it as
having been added, when in fact it is actually merely changed.  I have not,
however, been able to think of any scenario where this condition could
occur unless the DataManager containing the Agent was itself being
reconfigured during the same transaction as the other events, which is an
"all bets are off, hold onto your butts" type proposition anyhow.

My guess is that your patch will probably work fine.  I've checked it in
locally and will incorporate it into a release soon.

At 04:09 PM 7/12/00 +0100, Steve Alexander wrote:
>Steve Alexander wrote:
>> 
>> "Phillip J. Eby" wrote:
>> >
>> > This would explain why you only get a change event, since if add happens
>> > after change, it is ignored.  I'm curious how the change event is getting
>> > called first, since...  Oh.  I'll bet I know what it is.  It's probably
>> > that manage_afterAdd is being called later in the ObjectManager code than
>> > it used to be, and/or Zope is trying to set an _owner attribute on the
>> > newly added object.  Crap.  This is going to take some rethinking to find
>> > another way to trap the Zope "add" event.  :(
>> 
>> 
>> Looks like you're right -- manage_setLocalRoles.
>
>I have patched the _objectAdding method of class Agent in Agents.py:
>
> ...
>
>I'm not sure whether this will have any nasty side-effects though.
>