[Zope] Change Notification
Is there a way for an object to be notified that it has been modified? In particular, I want to create Relation objects that relate two arbitrary Folders. Creating the Relation object with a ZClass is easy (even for a newbie like me :-) ), but I need to update the relation links if the destination folder is moved. My thinking is that I need a parentChanged method that is invoked by a parent. parentChanged would then recursively invoke parentChanged for each of its child folders. The purpose of parentChanged would be to look for any relation objects that referenced the old location and either 1) change the reference to the new location if the old location is no longer valid (i.e. a Cut/Paste operation), or 2) add the new location if the old location is still valid (i.e. a Copy/Paste operation). This sounds expensive, and I'm not sure how to kick off the process. Does a "Paste" create a new instance? Thanks for the help, Bob Barter ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Change Notification
Hi, Bob Barter wrote: > > Is there a way for an object to be notified that it has been modified? > > In particular, I want to create Relation objects that relate two arbitrary > Folders. Creating the Relation object with a ZClass is easy (even for a newbie > like me :-) ), but I need to update the relation links if the destination folder > is moved. if it is in aqisition path, may help. It would give you the URL of the object whereever it is at the moment. May be, you could use ZCatalog otherwise. HTH Tino Wildenhain ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Change Notification
Bob Barter wrote: > > Is there a way for an object to be notified that it has been modified? Use ZPatterns 0.4, it allows you to be notified of events - change, add and delete of objects. -- Itamar S.T. [EMAIL PROTECTED] Fingerprint = D365 7BE8 B81E 2B18 6534 025E D0E7 92DB E441 411C ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Change Notification
Itamar Shtull-Trauring <[EMAIL PROTECTED]> wrote: > > Bob Barter wrote: > > > > Is there a way for an object to be notified that it has been > > modified? > > Use ZPatterns 0.4, it allows you to be notified of events - change, > add and delete of objects. I may be confused, but normally the object should _know_ that it has been modified, because one of its methods has been called. In fact, the usual pattern for this is to have the object notify other interested parties ("Observers") of the fact that it has changed. 2.2 has experimental support for this -- see $ZOPE/lib/python/OFS/DefaultObservable.py. Also, see the writeup on this in the Intefaces wiki (start from http://www.zope.org/WikiCentral -- look for ObserverAndNotification. Tres. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )