[Zope-dev] aq_explicit isn't?

Chris Withers chrisw@nipltd.com
Mon, 11 Jun 2001 13:23:05 +0100


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:

    def __getattr__(self, name, higher_getattr=higher_getattr):
        if self.__enabled:
            if name in self.__names:
                return higher_getattr(self, name)
            return higher_getattr(higher_getattr(self,'aq_explicit'), name)
                
        return higher_getattr(self, name)

where higher_getattr comes from:

try:
    higher_getattr = Folder.inheritedAttribute('__getattr__')
except:
    def higher_getattr(self, name):
        raise AttributeError, name


Except, using self.aq_explicit instead of self has no effect, the name is still
acquired normally :-(

What's going on?

This feels like the same bug in aq_explicit that I posted here and in the
collector to no response :-S

cheers,

Chris