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') and the following PageTemplate: <a tal:condition="python:r.object.check4index_html()==1" tal:content="r/object/title_or_id" tal:attributes="href url" target="main">Id</a> For some reasons the condition evaluates to true all the time. The script works fine and the objects are valid ( I see the right title). So what is wrong ? Thanks for any ideas.... Volker ______________________________________________________________________________ Mit der Multi-SMS von WEB.DE FreeMail koennen Sie 760 Zeichen versenden. Informationen unter http://freemail.web.de/features/?mc=021184
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. foo.aq_explicit only partially unwraps foo. foo.aq_base completely unwraps foo. http://mail.zope.org/pipermail/zope-coders/2002-August/001646.html -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's DIRECTOR OF PERILOUS ! (random hero from isometric.spaceninja.com)
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
Hi Volker, Volker Wend wrote at 2003-2-13 22:27 +0100:
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')
and the following PageTemplate:
<a tal:condition="python:r.object.check4index_html()==1" tal:content="r/object/title_or_id" tal:attributes="href url" target="main">Id</a>
For some reasons the condition evaluates to true all the time. The script works fine and the objects are valid ( I see the right title).
So what is wrong ? Almost surely, its the "aq_explicit". It can only restrict acquisition but not prevent it completely.
Because of this, I put a feature request (with patch) into Zope's collector (<http://collector.zope.org/Zope>). Search for "hasattr_unacquired"). I really hope it will find its way into Zope 2.7 and we get rid of the unreliable "aq_explicit" hack. Maybe, Chris Withers can help with this. I know, you will be able to apply the patch yourself (until it is in an official Zope distribution). Dieter
participants (4)
-
Chris Withers -
Dieter Maurer -
Paul Winkler -
Volker Wend