[Zope-dev] __getattr__ and Acquisition

Jeffrey P Shell jeffrey@cuemedia.com
Mon, 23 Sep 2002 19:47:33 -0600


On Monday, September 23, 2002, at 09:14  AM, Andreas Kostyrka wrote:

> Am Mon, 2002-09-23 um 11.12 schrieb Florent Guillaume:
>> Anoter way to do that is to play games with __of__.
>> Look at the implementation of the skins tool in CMF for an example.
> Doesn't help, as I do NOT know my container :(
>
> Basically __getattr__ when called does not know it's containment
> anymore. :(

This is why my stock suggestion to needing to do anything with 
acquisition and __getattr__ (or any other acquisition jump-arounds) is: 
Don't.  There are a lot of complexities that can arise out of 
Acquisition, Wrappers, and so on, that really require a deep 
understanding of exactly HOW acquisition works, versus what it usually 
does.

The other problem with __getattr__ is interfacing with Persistence.  
ZODB handles it now, but it wasn't all that long ago that it couldn't.

But with Acquisition - once you go beyond "fair use", there's not 
enough Scotch in the world to kill the brain cramp.  :)