[Grok-dev] Re: Keeping indexes up to date

Philipp von Weitershausen philipp at weitershausen.de
Fri Aug 10 07:38:59 EDT 2007


On 10 Aug 2007, at 13:35 , Luciano Ramalho wrote:
> On 8/10/07, Philipp von Weitershausen <philipp at weitershausen.de>  
> wrote:
>> Note that the two container events, IObjectAddedEvent and
>> IObjectRemovedEvent, are already sent by container operations and
>> needn't be sent by you.
>
> The fact that those were already taken care of tripped me.

Well, there's a reason for that. When you add an object to a  
container, the container sets __parent__ and __name__ on that object.  
Not you, the container. That's why the container is responsible for  
sending the event, not you.

> If a object is smart enough to know when it was changed for the sake
> of persistency, shoudn't it fire IObjectModifiedEvents as well?

First of all, objects are *not* smart. They're really really dumb.  
They should have as little functionality as possible. They're just  
data bags. This data may be persisted by the ZODB and the ZODB may  
have ways to find out which attributes changed, but this is rarely  
enough information for an IObjectModifiedEvent (remember, this event  
contains information about which fields of which schema were changed).

Also, what do you about objects that aren't persisted in the ZODB?




More information about the Grok-dev mailing list