Zopesters, I am trying to make a python based class be Catalog Aware and be reindexed when it is edited. I basically started with the Boring Product How-To, and have turned it into a Company Product. The class inherits from CatalogAware (someone somewhere said that CatalogAware had to be the first base class). I create my Company instance in another class by calling the constructor with no values, then immediately calling the manage_edit method to update the data. Based on that, I am trying to index the object in the constructor, and reindex the object in the manage_edit. With the code below, the object gets indexed in the catalog, but all the fields (indexes) are blank! The reindex_object call is not working for some reason. (At least it is not updating the field indexes like I would expect.) The other gotcha is that I have named my catalog something other than the default "Catalog". I believe the line, self.default_catalog='YPCatalogForSorting' takes care of renaming it. I have a feeling that I have a problem with Acquisition. It seems like the constructor knows how to find the catalog, but the manage_edit does not... Thanks for any help, Chris class Company( Products.ZCatalog.CatalogAwareness.CatalogAware, # Catalog Aware OFS.SimpleItem.Item, # A simple Principia object. Not Folderish. Persistent, # Make us persistent. Yaah! Acquisition.Implicit, # Uh, whatever. AccessControl.Role.RoleManager # Security manager. ): . . . def __init__(self, id, title='', REQUEST=None): self.id = id self.title = title self.a_companyName='' ## This is for CatalogAware. self.default_catalog='YPCatalogForSorting' self.index_object() . . . def manage_edit(self, title, REQUEST='', a_companyName=''): """does this really need a doc string?""" self.title = title self.a_companyName = a_companyName ## This is for CatalogAware. self.default_catalog='YPCatalogForSorting' self.reindex_object()
participants (1)
-
Chris Crownhart