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

Steve Alexander steve@cat-box.net
Tue, 11 Jul 2000 22:48:27 +0100


"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.  :(

Is this a way around the problem, or am I only seeing half the picture
:-) ?

You could have a flag in DataSkin instances called _has_been_added. It
is initially cleared. It gets set when manage_afterAdd is called on it.

The DataSkin sends an _objectChanging event only if the _has_been_added
flag is set.

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net