[Zope] dtml-tree & skip unauthorized

Cliff Ford Cliff.Ford at ed.ac.uk
Wed Oct 27 10:30:26 EDT 2004


This is my bit of dtml that produces a site map:

<p><a href="&dtml-URL0;?expand_all=1">Exapand All</a> |
<a href="&dtml-URL0;?collapse_all=1">Collapse All</a> </p>
<dtml-tree branches="siteMapSkip" skip_unauthorized nowrap="1" 
sort="title_or_id">
<a href="&dtml-absolute_url;"><dtml-var title_or_id></a>
</dtml-tree>

and siteMapSkip is a Python script that allows me to set a Property in a 
folder that I do not want seen in the site map:

"""
Check for a skip property in folders that should not appear in the Site Tree
Examples include imagesr, imagest
"""

results=[]
for object in context.objectValues(['Folder']):
     if object.hasProperty('siteTreeSkip'):
         pass
     else:
         results.append(object)
return results

An anonymous user can produce a complete site map, including showing 
folders within folders where login is required. However, if an anonymous 
user clicks the link to a protected folder the login sequence is 
triggered. I did this a long time ago and can't remember why it works. I 
guess because I am calling my own function on each branch.

Cliff


Stéphane Peillon wrote:
> Hello,
> 
>       I would like to make a site map for my plone site (with Zope 2.7.2 
> and Plone 2.0.4) with the dtml-tree function... When I tried my code, 
> it's successful with the administrator count but it raise an exception 
> "An error occurred. Error type: Unauthorized Error value: You are not 
> allowed to access 'Documentation' in this context", although I use the 
> "skip unauthorized" in the declaration of the dtml-tree tag. I also try 
> to use skip unauthorized=1 with no more success.
> 
>       Is someone can help me ?
> 
> Sorry for my English
> Stéphane
> 
> 
>      _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )


More information about the Zope mailing list