[Zope-dev] CatalogAwareness?

Kevin Dangoor kid@kendermedia.com
Sun, 1 Aug 1999 11:41:56 -0400


-----Original Message-----
From: Michel Pelletier <michel@digicool.com>
To: Kevin Dangoor <kid@kendermedia.com>
Cc: David Kankiewicz <kankie@thegrid.net>; Zope-Dev@zope.org
<Zope-Dev@zope.org>
Date: Sunday, August 01, 1999 2:18 AM
Subject: Re: [Zope-dev] CatalogAwareness?


>Kevin Dangoor wrote:
>>
>> 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?)
>
>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.

For my 'Findable' class, I made an updateObject method that will uncatalog
and then recatalog the object. I guess I was curious if the CatalogAware
class has such a method as well.

>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.

That would be nifty. Then the cataloging machinery is quite transparent.
Just make the ZClass inherit from CatalogAware and setup the Catalog with
the properties you want and you're all set!

It's not too onerous to have to call an update or refresh method when the
object is edited, however.

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

I believe the Hacker's Dictionary says "any noun can be verbed".

Kevin