[Zope] Clarifying ZCatalog-aware update conditions

Kevin Dangoor kid@kendermedia.com
Mon, 20 Sep 1999 16:50:13 -0400


-----Original Message-----
From: Chris Fassnacht <cfassnacht@ssc.wisc.edu>
To: zope@zope.org <zope@zope.org>
Date: Monday, September 20, 1999 4:11 PM
Subject: [Zope] Clarifying ZCatalog-aware update conditions


>If I understand correctly, the catalog will automatically reflect any
>changes after the following processes:
>
>- Adding an object.

Yep. Be aware though that if you are setting properties in your ZClass_add
method, you will need to call reindex_object afterwards.

>- Deleting an object (but not if you delete the folder which contains the
>object (but what if the object IS a folder?)).

Hmm... I know that deleting seems to remove the object from an index, but I
didn't realize that if you delete the folder that the object does not go
away... I've never tried it.

>- Changing the properties of an object (but if done with a custom property
>sheet, must use the reindex_object command).

Nope. If you want the changes to be reflected in the catalog, you must
create your own custom property sheet and call reindex_object in your change
DTML method.

>I'm confused about the reflected changes, however, because there seems to
be
>two distinct operations in the catalog that may or may not be part of the
>automatic updating process:
>
>- Indexing the object (locates the object(s) and gathers all the relevant
>index information).
>- Updating the catalog (adds the relevant index information to the
catalog).

When you perform "Find"s to the Catalog or click the "Update Catalog"
button, I think CatalogAware ZClasses will act just like any other type of
objects. CatalogAware basically adds the Add/Delete hooks and a couple
useful functions (like reindex_object).

>Okay.  What is actually happening in my application is that when I add one
>of my ZClass objects (inherits from _ZClass_for_CatalogAware and
>_ZClass_for_Folder, in that order), my catalog does NOT automatically
>reflect the addition.

This sounds strange. I haven't had this problem... From what I've seen, my
CatalogAware objects have added themselves just fine. I've never inherited
from Folder, though. I have used ObjectManager, and that has worked fine.

Kevin