[Zope3-dev] copy'n'paste doesn't send events...

Marcus J. Ertl Marcus J. Ertl" <marcus.ertl@larp-welt.de
Tue, 03 Jun 2003 00:01:49 +0200


Hello!

I'm just trying to keep my indices (now stored in pgsql, that makes
very good performance) in track with the zope objects.

For this I tried to send events in case of copy and paste, but no
events are send! This are the relevant parts of my code::

class LNMessage(Folder):
    """
    """

    __implements__ = (IAddNotifiable, IDeleteNotifiable, ILNMessage,
IAnnotatable, \
                      ILNCatalogObject, Folder.__implements__)

   ...

    def afterAddHook(self, object, container):
        publish(object, ObjectAddedEvent(object))


    def beforeDeleteHook(self, object, container):
        for id in self.data.keys():
            if ILNMessage.isImplementedBy(self.data[id]):
               
self.data[id].beforeDeleteHook(ContextWrapper(self.data[id], object,
name=id), object)
        
        publish(object, ObjectRemovedEvent(object))


For adding and deleting, this works very fine (but the problem, that I
get each event twice...). But it never sends a event for copy and
paste! Why?

(Yes, in beforeDeleteHook, there is a dirty hack, I should use
getAdapter...)

Bye
   Marcus

-- 
Die Fantasie ist ein maechtiges Werkzeug.  Sie kann Erinnerungen
faerben, Wahrnehmungen der Gegenwart verschleiern oder uns die 
Zukunft so lebendig vormalen, dasz sie uns lockt...  oder entsetzt,
je nachdem, wie wir uns heute verhalten...
                                                          Garfield

LARP-Welt - Das LARP-Portal im Internet: http://larp-welt.de