[Zope] Aquisition

Chris Withers chrisw@nipltd.com
Fri, 14 Feb 2003 09:14:46 +0000


Paul Winkler wrote:
> On Thu, Feb 13, 2003 at 10:27:11PM +0100, Volker Wend wrote:
> 
>>Hello Folks,
>>
>>I am developing an Page Template that should create a link depending on the content of that folder. If I find an index_html, I want a Link otherwise not.
>>
>>I have a Python Script check4index_html:
>>
>>return hasattr(context.aq_explicit,'index_html')
> 
> 
> I think what you want is context.aq_base.

Much better to do:

from Acquisition import aq_base
return hasattr(aq_base(context),'index_html')

...in case context is not wrapped.

However, given the name of the variable, I'm guessing this is in a Script 
(Python), in which case aq_base isn't allowed for security reasons.

aq_explicit should work, thinking about it.

cheers,

Chris