[Zope3-dev] ObjectHub/Event service: who sends those events anyway?

Gary Poster gary@zope.com
16 Oct 2002 15:10:53 -0400


[the fourth in an exciting email series centering on the object hub]

This email begins to enter possible wiki territory: I may transfer it
eventually.

While we have an event service that can deal with events relatively
well, and an object hub that begins to do some interesting things with
those events, we actually don't have anything sending object events yet!

We actually need to talk then about both cut and paste operations,
because they have not yet been discussed (I think?), and then about
sending events.

PROPOSAL:

For copy and paste, it seems to me that we can shuffle off the cookie or
session tracking mechanism to the view code, so that the container
itself might only need something like this:

class ICopyPasteContainer(IContainer):
    def moveTo(key, destination): 
        "move the item specified by key to the destination"
    
    def duplicateTo(key, destination):
        "copy the item specified by key to the destination"

I also want a "link" in there but I won't scope creep here. ;-)

Then we would need the following modification for a folder that sends
events:

class IVocalContainer(ICopyPasteContainer):
    def setObject(key, object):
        """sets object and sends an IObjectAdded event"""
    
    def silentSetObject(key, object):
        """does not send an event; used by moveTo and duplicateTo"""
    
    def __delitem__(key):
        """deletes object and sends an IObjectRemoved event"""
    
    def silentDel(key):
        """does not send an event; used by moveTo"""
    
    def moveTo(key, destination, newkey=None):
        "moves and sends an IObjectMoved event"""
    
    def duplicateTo(key, destination):
        "duplicates and sends an IObjectDuplicated event"
    
Notice that's a new event type--IObjectDuplicated.  Presumably it would
need a hub event parallel as well.

Then the folder handles all of the events for the contained objects
except for IModified.  I think one possible ObjectHub subscriber might
reject any moves that tried to move a registered object into a
non-IVocalContainer, for instance.

Yes?

--------

Are you worried that I'm done yet?  Don't be!  That's it for a bit,
though.