[Zope] Clarifying ZCatalog-aware update conditions
Chris Fassnacht
cfassnacht@ssc.wisc.edu
Tue, 21 Sep 1999 00:00:00 -0500
Kevin,
What a learning experience! After reading your comment about inheriting
from ObjectManager, I decided to see if that might be the problem (since I
didn't inherit from it). Of course, I had a lot of objects already in the
database. So, after some searching, I discovered Andreas Kostyrka's
external methods based on Michel Pelletier's "secret" hack to convert the
inheritance of already defined ZClasses (in
http://www.zope.org/pipermail/zope-dev/1999-August/001288.html, but the
readable code is in http://www.egroups.com/list/zope/md2078511860.html). It
worked great at changing the inheritance of my objects (a very cool hack),
but it did not fix my ZCatalog problem.
So, heeding Zobi Wan Kenobi, I went to "Use the Source, Luke." And in
CatalogAwareness.py I noticed that the default_catalog name was "Catalog."
Now, following Michel Pelletier's ZCatalog How-To, I had named my ZCatalog
"catalog." Sorry to admit it, but I come from the Dos/Windows world, which
is case insensitive, so I hadn't a clue. After changing the id of my
ZCatalog to the capitalized version it now works like a charm. Oh well.
Thanks for the help, though.
Chris
> -----Original Message-----
> From: Kevin Dangoor [mailto:kid@kendermedia.com]
> Sent: Monday, September 20, 1999 3:50 PM
> To: cfassnacht@ssc.wisc.edu; zope@zope.org
> Subject: Re: [Zope] Clarifying ZCatalog-aware update conditions
>
>
> -----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
>
>