[Zope3-dev] Index integration

Jim Fulton jim at zope.com
Wed Feb 16 07:24:49 EST 2005


Dieter Maurer wrote:
> Jim Fulton wrote at 2005-2-14 14:26 -0500:
> 
>>...
> 
> [JF]
> 
>>>>I'm not sure I follow this.  Are you saying that you'd generate
>>>>an ObjectModified event for the dependent object and then decide the
>>>>indexes to update according to the type of the dependent object?
> 
> 
> [DM]
> 
>>>Indeed.
>>>
>>>But the object for which the indexes are updated is
>>>is not the dependent object but its primary object.
>>>
>>>Dependent objects are not catalogued (indexed) by themselves.
>>>With respect to cataloguing they behave as part of their
>>>primary object.
> 
> 
> [JF]
> 
>>Right. This feels pretty complicated.  Maybe I'm missunderstanding,
>>or maybe I just need to think about it some more. :)
> 
> 
> The complexity consists of a few lines of code only:
> 
>   The dependent object must know its primary.
> 
>   The catalog must check whether the object to be [un]catalogued
>   implements "IDependentObject" and in this case
>   determine the objects catalog id for the primary rather
>   then the object itself.
> 
> On the positive side you get rid of lots of event definitions
> (and their imports).

My concern isn't with the code complexity, but with the conceptual
complexity.  Anyway, I'm not saying I disagree with your proposal.
I just need to think about it.

BTW, a possibly simpler take on your proposal:

Object-change adapters (Masks?)

- We can adapt an object to an interface that
   captures just the relevent change.

- We arrange that the adapted object adapts to the same
   reference and thus gets the same unique id

- The adapted object is only recognized and thus
   only indexed by the relevent indexes.

Perhaps these adapters are "filters" or "masks", the
opposite of decorators.  Rather than adding interfaces
to an object, they mask out interfaces.

With this approach, indexes (or catalogs) don't need to
be aware of what's going on.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the Zope3-dev mailing list