[Zope-CMF] Re: Skinnable.py Optimisation breaks Acquisition context.
Shane Hathaway
shane@zope.com
Wed, 11 Sep 2002 13:19:06 -0400 (EDT)
On Wed, 11 Sep 2002, Chris Withers wrote:
> Shane Hathaway wrote:
> >
> > Yes. AFAIK you don't need the context of self. You only need the parent.
> > The parent holds the REQUEST, doesn't it?
>
> Well, normally yes. BUT....
>
> SimpleTree's node() method stores the object in an attribute a la:
>
> node.object = object
>
> ...which of course means the parent has no context, so REQUEST needs
> to be acquired from the context of self. Sadly, your optimistion
> removes this context :-S
Ok, now I remember: I discovered that using aq_base() fixed a bug in
AdaptableStorage, and I wanted to see if it was really the right thing to
do, so I applied the same fix to CMF. It seems apparent now that __of__
doesn't need to use aq_base(). You can make the change you suggested if
you like.
The odd thing is that the most obvious approach blows up somehow. I
originally tried:
w_self = Acquisition.Implicit.__of__(self, parent)
I don't remember what went wrong when I did that, but it broke. Who
knows, maybe it works now. ;-)
Shane