[Zope-dev] aq_explicit isn't?

Dieter Maurer dieter@handshake.de
Mon, 11 Jun 2001 19:36:51 +0200 (CEST)


Chris Withers writes:
 > Dieter Maurer wrote:
 > > 
 > > What you probably need:
 > > 
 > >   derive a new ObjectManager from Acquisition.Explicit and
 > >   the current ObjectManager.
 > > 
 > >   provide an interface to manage the attributes that should
 > >   be acquired implicitly.
 > 
 > Well, I had a go at this, but not quite in the way you describe.
 > 
 > I subclassed Folder and overrode __getattr_ with:
This does not work because Python calls "__getattr__" only,
if it can not find the attribute through "normal" means.
Due to the implementation of "Acquisition", acquired attributes
are found by "normal" means bypassing "__getattr__".

You may be successful, if you override "__of__".
It is this method that (usually) builds the acquisition wrapper.
You can try to build an explicit rather than implicit acquisition
wrapper.

The easiest way, of course, is to derive the class from
"Acquisition.Explicit" with higher priority (more to the left)
than from "Acquisition.Implicit".


Dieter