Stefan H. Holek writes:
> If I want to know whether a certain object is contained in
> the current folder I do this:
>
> <dtml-if "'index_html' in this().objectIds()">
> yes it's here
> <dtml-else>
> not here
> </dtml-if>
>
> Id like to know whether this is the best/most efficient way to do it.
> Things like hasattr() are subject to aquisition i.e. they would find
> an index_html method along the acquisition path...
There is a trick:
<dtml-if "hasattr(aq_explicit,'index_html')">
avoids (implicit) acquisition.
How it works:
"aq_explicit" returns the explicit acquisition wrapper
for "this". This wrapper does not acquire automatically
but must be told explicitly. As "hasattr" does not to
that, it tests for an attribute of "this()" and
not an acquired attribute.
Dieter
_______________________________________________
Zope maillist - [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://lists.zope.org/mailman/listinfo/zope-announce
http://lists.zope.org/mailman/listinfo/zope-dev )