[Zope-dev] New info for ZCatalog and CatalogAware classes, and Question

Bill Anderson bill.anderson@libc.org
Thu, 30 Dec 1999 16:13:02 -0700


This seems to apply to two howtos:
(A) How-To: Creating a CatalogAware ZClass
(B) How-To: Inheriting from ZCatalog as a Container

So I thought I would post it here so that both authors, and the rest of
the dev community can see it and comment on it. I apologize for any
roughness, I am hoping one or both of the howtos would be updated to
reflect the new data. Alternatively, I could make a seperate howto if
needed.


What I was doing:
I am working on a product (KnowledgeKit v2.0) that has a root container
inherited from ZCatalog, and has Catalog_Aware Objects inside of it. The
basics of what I did can be extrapolated further for other
circumstances.

For the Catalog_Aware object:

In the add_form, I added a hidden variable, called 'catID', and gave it
a value:
<input type=hidden name=catID value="<dtml-var "PARENTS[0].id">">

This will work when the object to be added form is under the Container
Object. See below for alternatives I have come up with.

Then, in the constructor method, I modified the code in HowTo A to be:
<dtml-call  unindex_object>
<dtml-call "manage_editCataloger(catID, REQUEST)">
<dtml-call index_object>

The benefit is that you can use the Catalog object (FooContainer in this
example) normally, ie. without adding the 'Catlog' DTML Method to the
Container object. 

Additionally, one could make a catalog in the root of the site, which
indexes every ZCatalog on the site, looking only for 'id', and create a
dropdown list on the object's add_Form to select the catalog to index
to. Look for an update on this with 2.0 of The KnowledgeKit. I believe
this answers one of the todo parentheticals in HowTo A:
(To do: how about adding a drop-down list to choose a catalog? Can I
register a class instance in several catalogs?]

<ramble>
Regarding the latter question there, is it possible to index in one
catlog, and then index in another? If so, you could do it by setting the
catalogue to one, indexing/modifyin, and then setting the catalog to
another, and repeating?
</ramble>


Question:
Are there any effects of making a ZClass which is also Catalog_Aware?
IOW, does it work?
Does it break anything?


Bill

-- 
In flying I have learned that carelessness and overconfidence are 
usually far more dangerous than deliberately accepted risks. 
          -- Wilbur Wright in a letter to his father, September 1900