Tom Deprez wrote:
Ok, it was the import problem! Thanks to all!
Q1: So, in python you've to say which class you want to import?
Q2: And from test.parent.mylib means go to the directory test then parent and then use the mylib library?
However, now I stumbeld on more problems. I receive an error about using an onbound method...
Q3: What is an unbound method??
A method that is not bound to a class instance. This is really a pretty strictly python question. I recommend you read the python language reference for a better description of this. I think you should not use an external method, but rather create a Python class that subclasses whatever you want to subclass and then defines a new manage_afterAdd that implements your behavior. I don't think external methods are ideal at all for this kind of development. This requires either reverse engineering existing Zope products or culling the list for this wisdom, there really isn't any formal recipie for this kind of thing. This isn't necessarily a documetation issue, for altough we can document interfaces and product conventions (which we are working on), we cannot entirely document every issue concerning engineering software in python.
Thanks to another email, I could solve this 'unbound method-error' with the following line :
CatalogAware.manage_afterAdd.im_func(self,item,container)
Off the top of my head, I don't know why you have to do this. Whether this is an artifact of developing with ZClasses and External Methods I couldn't tell you either. But I do know that when developing a pure python class this does not need to happen and is probably a bad idea to get into the habit.
Now, adding an instance works without a problem, but when a try to cut and paste the instance, I get the following message:
Zope Error
Zope has encountered an error while publishing this resource.
Error Type: AttributeError Error Value: aq_acquire
This is probably a known bug in 2.1.4, but without a traceback I cannot tell you definatly. You should allways post traceback when you are trying to get an explanation of a development error. If this is the same bug, it is fixed in CVS and you should get the latest version of lib/python/Products/ZCatalog/CatalogAwareness.py from the public CVS server. -Michel