[Zope-CMF] Re: Skinnable.py Optimisation breaks Acquisition context.

Shane Hathaway shane@zope.com
Wed, 11 Sep 2002 07:33:57 -0400 (EDT)


On Wed, 11 Sep 2002, Chris Withers wrote:

> Hi Shane,
>
> I had a really weird problem yesterday trying to use ZTUtils to render a
> structure tree of a CMF site:
>
> http://lists.zope.org/pipermail/zope-cmf/2002-September/015161.html
>
> ...which I finally tracked down to this change you made to Skinnable.py:
> http://cvs.zope.org/CMF/CMFCore/Skinnable.py.diff?r1=1.3&r2=1.4
>
> The key change was from:
> ImplicitAcquisitionWrapper(self, parent)
> ...to:
> ImplicitAcquisitionWrapper(aq_base(self), parent)
>
> ...which strips off part of self's acquisition context.
> Was this intentionsional?

Yes.  AFAIK you don't need the context of self.  You only need the parent.
The parent holds the REQUEST, doesn't it?

> In any case, would anything bad happen if I committed the following
> patch to CVS?
>
> 134c134
> <         w_self = ImplicitAcquisitionWrapper(aq_base(self), parent)
> ---
>  >         w_self = ImplicitAcquisitionWrapper(self, parent)
>
> ...it appears to fix the problems I was having with ZTUtils not being able to
> acquire the REQUEST.

Don't commit this.  If this really is a problem then we need to try harder
to precisely duplicate the behavior of Acquisition.Implicit.__of__().
Your bug seems to indicate that neither way is correct, since adding
aq_base fixed a different bug. ;-)

Shane