[Zope] How to make my product catalogaware

Ben Last (Zope) zope at benlast.com
Thu Jun 10 06:46:40 EDT 2004


> From: Garito
> Hi
> Have you some tutorial or help about how to make my product catalogaware?
1) inherit from CatalogAware, and define the default catalog and override
PrincipiaSearchSource:

from Products.ZCatalog.CatalogPathAwareness import CatalogAware

class MyProduct(CatalogAware...

    #...snip...

    #
    # Stuff to support Cataloging
    #

    default_catalog = "FloofStorage"

    def PrincipiaSearchSource(self):
        """Return cataloguable key for ourselves."""
        return str(self)

2) Ensure that you call self.reindex_object() whenever there's a change to
any attributes that may be cataloged.  You should be sure to do this in any
methods that override those of CatalogAware itself (in particular,
manage_addProperty, manage_editProperties, manage_changeProperties,
manage_delProperties, etc).

Espero que esto es suficiente para comencar...

ben


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________



More information about the Zope mailing list