[Zope] CatalogAware

Tres Seaver tseaver@palladion.com
Wed, 23 Feb 2000 15:01:52 -0600


Tom Deprez <tom.deprez@uz.kuleuven.ac.be> wrote:
> 
> I've a problem which I can't solve.
> 
> I made a small ZClass and has CatalogAware as base class.
> 
> However, when I add an instance of this ZClass in a folder, and when I've a
> ZCatalog (id: TestCatalog) then this instance isn't added in the list of
> 'TestCatalog'. I thought that a CatalogAware Class just could do this...
> 
> a) Am I missing here something?
> b) I'm not quite sure, but is this adding to a Catolog done automatically
> or do you have to specify somewhere in which catalog instance (here
> TestCatalog) the object has to be listed? How can I do this?


"Loren Stafford" <lstaffor@dynalogic.com> replied:
> 
> If you have a non-default catalog ID, you have to do something special in
> the manage_add method. It's documented in the How-To on creating a
> catalog-aware Zclass. http://www.zope.org/Members/AlexR/CatalogAware

CatalogAware instances expect to find and register themselves with a ZCatalog
object named "Catalog".  If you want them to use a catalog with a different
name, you can either:

 * Modify their class' MyClass_add method to switch them (as described by the
   HowTo Loren points to).

or:

 * Attach a "proxy" DTML/Python/External Method named "Catalog" which
   hijacks the lookup to your desired location.  I have a How-To describing
   this technique at:

    http://www.zope.org/Members/tseaver/inherit_ZCatalog 

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