[Zope] dtml-if for a boolean property

Loren Stafford lstafford@morphics.com
Fri, 29 Jun 2001 14:55:01 -0700


I had a problem similar to yours, so I wrote this DTML method named
"is_hidden".

<dtml-comment>
Return true if the current folder should be hidden from the public.
Obsoletes (by inclusion) the noindex property.
A property was hard to use, because ZClasses implement properties
differently.
Now that this is a method, it can be overridden in any folder tree.
</dtml-comment>
<dtml-if "AUTHENTICATED_USER.has_role(['Manager'])">
<dtml-return "0">
</dtml-if>
<dtml-if "hasProperty('noindex') and noindex">
<dtml-return "1">
<dtml-else>
<dtml-return "0">
</dtml-if>

-- Loren

> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Leigh
> Ann Hildebrand
> Sent: Friday, June 29, 2001 13:55
> To: zope@zope.org
> Subject: [Zope] dtml-if for a boolean property
>
>
> I'm using 2.3.2. I've got a dtml-method, index_outline, to display folder
> contexts for dynamic index_html pages. It had included the a dtml-if
> statement <dtml-if "_['id']=='index_html'"></dtml-if>, to prevent the
> index_html files themselves from displaying in the file list.
>
> It occurred to me that I had other files and types of objects that I
> didn't want to show in my index_html, so I'd be better off using
> a property
> (index_hide in this case) that I could set for individual
> objects. However,
> when I've tried to modify the above dtml-if statement for a
> boolean index_hide
> property, it doesn't work.
>
> What's the proper syntax for that? A value of true for index_hide should
> prevent it showing.
>
> Thanks!
>
>
> --
> Leigh Ann Hildebrand
> leighann@onebox.com - email
> (650) 223-2199 x2231 - voicemail/fax
>
>
>
> __________________________________________________
> FREE voicemail, email, and fax...all in one place.
> Sign Up Now! http://www.onebox.com
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> 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 )
>