Hi! Thanks. On Tue, 26 Oct 1999, Phillip J. Eby wrote:
Acquisition is part of the ExtensionClass package, so that's what you need to install.
I did this (actually, I have Zope up and running, I just want to use some components in other projects).
To use it, in the simplest way, make all your objects' classes inherit from Acquisition.Implicit. Then, whenever you retrieve one object from another, it will acquire attributes from the object it was retrieved from.
To loosen the rules slightly, the object you want to have acquire attributes from its parent is the only thing which needs to subclass from Acquisition.Implicit. The parent can inherit from ExtensionClass.Base, if the parent does not itself need to acquire things from its parent.
I think we need to mention to NOT override __getattr__, if I understand how aquisition works; or at least override it with care, right? What if I want to avoid aquisition sometimes? Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd@phd.russ.ru Programmers don't die, they just GOSUB without RETURN.
participants (1)
-
Oleg Broytmann