Re: [Zope] ZCatalog and custom Product
Milos Prudek wrote: The above code catalogs the instance into Catalog_A. Okay, but self.manage_editCataloger("Catalog_A") self.index_object() self.manage_editCataloger("Catalog_B") self.index_object() self.manage_editCataloger("Catalog_C") self.index_object() ... the above code catalogs the instance into Catalog_C, but not into Catalog_A and not into Catalog_B. Does anyone know why Catalog_A and Catalog_B are ignored? Using CatalogPathAware with multiple catalogs is asking for trouble, since it's onyl designed to support one catalog ;-) I'd suggest not using it in your case. Just write your own index_object method that does what you really want it to... cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] ZCatalog and custom Product
Milos Prudek wrote: > Hi, > > I need to convert a ZClass cataloged in multiple ZCatalogs into a > Product. I know how to create a Product. But I have trouble > understanding how to create a proper ZCatalog and manage it in a Product. To answer myself, simply follow Garito's advice of 10.6.2004 in mailing list archive. Now the only problem is multiple catalogs. I need to catalog my class into Catalog_A, Catalog_B and Catalog_C upon instantiation. class MyClass(CatalogPathAware): def __init__(): self.manage_editCataloger("Catalog_A") self.index_object() The above code catalogs the instance into Catalog_A. Okay, but self.manage_editCataloger("Catalog_A") self.index_object() self.manage_editCataloger("Catalog_B") self.index_object() self.manage_editCataloger("Catalog_C") self.index_object() ... the above code catalogs the instance into Catalog_C, but not into Catalog_A and not into Catalog_B. Does anyone know why Catalog_A and Catalog_B are ignored? -- Milos Prudek ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] ZCatalog and custom Product
Hi, I need to convert a ZClass cataloged in multiple ZCatalogs into a Product. I know how to create a Product. But I have trouble understanding how to create a proper ZCatalog and manage it in a Product. When I change my ZClass instance, it reindexes itself in multiple ZCatalogs. I have the following DTML method "edit" in my ZClass (stored in ZODB) that takes care of this: How should this be programmed in Products? - Should I first create a ZCatalog instance in ZODB, and then bind this instance to my Product? That would make my Product not self-contained. - or should the Product rather create ZCatalog instance during its initialization? That would mean that upon Zope restart, ZCatalog instance would be removed and re-created and all Product instances would have to be recataloged. In my new Product (that is to replace my ZClass), I put this line: from Products.ZCatalog.ZCatalog import ZCatalog and I added ZCatalog to the list of subclassed classes: class ArtBase(ZCatalog, ObjectManager, SimpleItem, PropertyManager, JMZPTMacros): but I have no idea what to do next. In this mailing list's archive, Chris Withers wrote that ZCatalog should be an attribute of a product's instance so that I can open the ZCatalog management interface by calling "my_prod_instance/catalog_name/manage". I understand that, but I have no idea how to achieve it. Should I add a line to my class __init__ ? Something like: def __init__(self,id,title=''): """Contructor method to initialize the properties of our class""" #Create and initilize the class attributes self.id=id self.title=title self.catalog=manage_addZCatalog(id="catalog", title="title") but the above looks fishy because I would have an isolated catalog for each new instance of my class... To support manage_editCataloger and reindex_object, do I need to import both ZCatalog from Products.ZCatalog and CatalogAware from Products.ZCatalog.CatalogAwareness ? -- Milos Prudek ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )