[Zope] Zclasses derived from ZCatalog

Tres Seaver tseaver@palladion.com
Tue, 02 Nov 1999 20:53:12 -0600


Tom Schwaller <tom.schwaller@linux-magazin.de> wrote:

> http://www.zope.org/Members/Zen/tips/tip_ZCatalogInZClass
>
> shows nicely how to add a ZCatalog in a ContainerClass.
> How does one implement the same functionality
> when deriving a class A from ZCatalog:
>
> A(ZCatalog) -- B(CatalogAware)

Check out my How-To, http://www.zope.org/Members/tseaver/inherit_ZCatalog

> How to modify
> <dtml-with "Catalog">
> <dtml-call "manage_addColumn('area',REQUEST,RESPONSE,URL1)"> ?

Just call the method (of the ZCatalog-derived class):

 <dtml-call "manage_addColumn( 'area', REQUEST, RESPONSE, URL1 )">

> <dtml-with _catalog>
> will not work. 

Right, attributes/methods starting with "_" are invisible to DTML.

> Then I'd like to add B-Objects,
> which are CatalogAware, to the A-Catalog.
>
> Right now I use only one instance of the A-class (Books)
> and add the Books (type B) by writing:
>
> <dtml-with "Book.createInObjectManager(REQUEST['id'], REQUEST)">
> <dtml-call "propertysheets.buchdaten.manage_editProperties(REQUEST)">
> <dtml-call unindex_object>
> <dtml-call "manage_editCataloger('Books', REQUEST)"> 
> <dtml-call reindex_object>
> </dtml-with>
>
> which is nonsense, but works for one Book-Folder with a defined name.
>
> I like deriving from ZCatalog, so the users do not see
> the Catalog (otherwise one could delete it) and the 
> ContainerClass (Books) is the catalog of its members (Book).
>
> Any hints?

This is essentially what I am doing -- I just tried adding a DTMLMethod named
"Catalog" to the ZCatalog-derived class, which just returns this() -- IT WORKS!


-- 
=========================================================
Tres Seaver         tseaver@palladion.com    713-523-6582
Palladion Software  http://www.palladion.com