[Zope] Creating CatalogAware products.
   
    Jens Vagelpohl
     
    jens@zope.com
       
    Thu, 12 Sep 2002 00:20:23 -0400
    
    
  
> * In the __init__ method, I have : self.index_object()
this will not work because inside __init__ the object has no "context", 
it has not been seated in a container and cannot "find" things 
(including your catalog) through acquisition yet.
add the manage_afterAdd and manage_beforeDelete hooks to you class and 
do indexing/unindexing in those::
def manage_afterAdd(self, item, container):
	""" what to do after i have been created """
     self.index_object()
def manage_beforeDelete(self, item, container):
	""" what to do before i get deleted """
	self.unindex_object()
those hooks get called automatically right after instantiating the 
object and right before it is deleted.
jens