[Zope3-Users] Re: Events
Philipp von Weitershausen
philipp at weitershausen.de
Thu Feb 22 07:44:16 EST 2007
On 22 Feb 2007, at 13:37 , David Johnson wrote:
>> You're probably talking about dispatchToSublocations. This is the
>> code that looks up a containers sublocations and dispatches the
>> event to them.
>>
>> One way to prevent this behaviour for your container is to write a
>> new ISublocations adapter for your container that simply returns
>> an empty sequence:
>>
>> class MyContainerSublocations(object):
>> implements(zope.location.interfaces.ISublocations)
>> adapts(...IMyContainer)
>>
>> def __init__(self, context):
>> self.context = context
>>
>> def sublocations(self):
>> return ()
> This is probably the approach I will follow, but what if I want my
> container objects notified?
I thought you don't... ?
> Even if I don't it seems the default Folder implementation follows
> this logic and so if you have a folder with several large images
> for example, then you will pay a price whenever an event is
> issued. In general it seems that any change will result in the
> entire ZODB being read for each event dispatch...if I still follow
> the logic here.
That's not what I said. It will only happen on object moves, in
particular, when a container is moved. It will also only happen for
the subitems of that container, not "the whole ZODB", though arguably
that can mean a lot of data.
I would personally like to see some form of disabling event handlers.
More information about the Zope3-users
mailing list