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

2000-07-12 Thread Steve Alexander

Steve Alexander wrote:
 
 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.

Of course, the name of the attribute should be more like
_v_has_been_added :-)

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

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




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

2000-07-12 Thread Phillip J. Eby

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.



___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )