[Zope-dev] ZCatalog with ZClass

Lily Li lli@kaval.com
Wed, 17 Jan 2001 18:44:09 -0500


Hi,

I tried it with a new product following the HowTo, and it works perfectly.
Thanks a lot.

But actually I have already an exsisted product with a Container ZClass
'KTracker'(inherit from ObjectManager) and an Item ZClass called
'TrackerIssue'. And it's been used for a while with the instance 'tracker'
and hundreds of issues inside. Now I've succeeded in changing the base class
for 'KTracker'to subclass ObjectManager and ZCatalog, and changing
'TrackerIssue' to CatalogAware. 

As 'tracker' instance was created before, although the base class is changed
now, the constructor of the new base class seems not running. So I created
an External Method to run the constructor of ZCatalog as follows:
    
    from Products.ZCatalog.ZCatalog import ZCatalog

    def initContainer(self):
        ZCatalog.__init__(self, self.id)        

Then I ran this method through IE browser:
http://hostname/.../tracker/initContainer. It seems working, as a Vocabulary
folder is created. And I could make settings to index and so on. 

But there's one thing incorrect: When using manage_catalogFind to catalog
the object of type 'TrackerIssue', nothing was returned. If changing the
finding type to 'All types', all the 'TrackerIssue' objects and other types
of objects are cataloged together. The auto-catalogAware works fine for
'TrackerIssue' objects though. 

Do you have any idea why this happens? Does it have anything to do with the
order of base class, etc.? If just the manage_catalogFind doesn't work well,
will it affect the searching stuff much, if CatalogAware works fine?

Thanks a lot.

Lily

-----Original Message-----
From: Michael Bernstein [mailto:webmaven@lvcm.com]
Sent: Wednesday, January 17, 2001 12:11 AM
To: Lily Li
Cc: 'zope-dev@zope.org'
Subject: Re: [Zope-dev] ZCatalog with ZClass


Lily Li wrote:
> 
> Hello, everyone,
> 
> It seems that many of you have used ZCatalog pretty well.
> 
> My problem is that I'd like a ZClass (of a Product) to subclass
> CatalogAware, and implement all the index and search inside the Product.
> That means I don't want to do any DTML method stuff outside of the
Product.

What you probably want is to create a repository that
subclasses ZCatalog as is described in this HowTo:

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

And then add your CatalogAware ZClasses into it. Then you
can set up your ZCatalog/ObjectManager with search methods.

HTH,

Michael Bernstein.