[Zope-dev] CatalogAwareness?

Michel Pelletier michel@digicool.com
Sun, 01 Aug 1999 02:12:23 -0400


Kevin Dangoor wrote:
> 
> -----Original Message-----
> From: Michel Pelletier <michel@digicool.com>
> To: David Kankiewicz <kankie@thegrid.net>
> Cc: Zope-Dev@zope.org <Zope-Dev@zope.org>
> Date: Friday, July 30, 1999 10:45 PM
> Subject: Re: [Zope-dev] CatalogAwareness?
> 
> >If a ZClass subclasses CatalogAware, and there is a 'Catalog' object in
> >it's acquisition path, they the object will automaticly catalog and
> >uncatalog itself when it is instanciated/deleted.
> 
> I'm setting up my own Findable base class (as discussed in previous
> messages) to handle this. It appears that if you change a property that is
> specified as meta data in the ZCatalog, you'll need to refresh that entry in
> the Catalog, right? Does CatalogAware deal with that at all? Does it offer a
> method to update the object? (Does anything happen automatically if the item
> is renamed or if properties are changed?)

At this layer, your objects will need to inform 'their' catalog when
information important to them changes.  Recently the add/delete protocol
in Zope changed, for the better, and CatalogAware is an attemp to hook
into that protocol and work with a cataloging system for adding and
deleting.

The way to Zope portal toolkit components keep themsevles current with
the Catalog is to first uncatalog themsevles, and then recatalog
themselves.  If the catalog that they acquire cares about some property
about that object, then those propeties will get cataloged.  otherwise
the object ignored.  

If I remember correctly, there are also hooks that objects can set on
themselves that get called by the zope transaciton machinery.  I would
need to ask jim if it's a good idea for an object to try to acquire a
catalog and uncatalogs and recatalogs itself right before the commit,
thus if the object changed the catalog recatalogs the object.

(The previous sentence reminds me of something Ken once said, 'Engish is
verbing.' (or was it 'English verbs.'?))

Catalog aware objects have an attribute that sets what catalog they care
about.  This is a bit weak, as Martijn Pieters and Amos have made
several suggestions about making changes to the way objects acquire a
catalog(s) to catalog themselves in.  I think CatalogAware can be a very
smart object in Zope.

-Michel



> 
> Kevin