Tom Deprez wrote:
Hi Rik,
Yes, thanks for replying! Getting non-experts replies is better then getting none because otherwise it looks like you're alone on Zope world.
Ok, I'll tell you something more :
I've created a ZClass with as base class CatalogAware. The external method just contains what I wrote below. In the ZClass method tab, I create a new method (manage_afterAdd) which points to this external method.
So when a ZClass instance is added or moved, the manage_afterAdd method should be executed.
If you want to use CatalogAware from an external method, you have to import it.
I did, but perhaps here is the mistake. Here is my full python script (and my first).
import sys sys.path.append('usr/local/zope/lib/python/Products/ZCatalog') import CatalogAwareness
if you want CatalogAware that should read: from CatalogAwareness import CatalogAware or refer to CatalogAware later on as: CatalogAwareness.CatalogAware.manage_afterAdd
""" CatalogAwareness contains the CatalogAware Class """
def manage_afterAdd(self,item,container) item.myparent=container.id CatalogAware.manage_afterAdd(self,item,container) return
I also tried this, but it always gives the same error :
def manage_afterAdd(self,item,container) import sys sys.path.append('usr/local/zope/lib/python/Products/ZCatalog') import CatalogAwareness
item.myparent=container.id CatalogAware.manage_afterAdd(self,item,container) return
same problem as above. Rik