[Zope] (Newbie) Tree based sitemap using Zope book example

Adrian Blockley adrian.blockley@environ.wa.gov.au
Tue, 23 Oct 2001 09:55:46 +0800


Hi All,

I am trying to develop a website that has a tree based site map on each
page. I have used an example in the Zope book where an objects appearence
in the sitemap depends on setting a property SiteMap and uses a small
Python script to test whether the property has been set.
 
The calling dtml method uses the following code:-

<dtml-tree branches="PublicObjects" skip_unauthorized="1">
  <a href="&dtml-absolute_url;"><dtml-var title_or_id></a>
</dtml-tree>


which in turn calls the following script.

""" 
Returns sub folders and DTML documents that have 
a true 'siteMap' property. 
""" 
results=[] 
for object in context.objectValues(['Folder', 'DTML Document']):
     if object.hasProperty('siteMap') and object.siteMap:
         results.append(object) 
return results


This works fine in that context.objectValues(['Folder', 'DTML Document'])
displays a tree based site map but of course creates it relative to the
current folder object.  For the life of me I can't work out how to change
the script or the call so that the tree that is displayed is always the
root tree or rooted in any specified arbitary folder. Is it possible to
specify a context rather than the current one? - I presume it is I just
don't understand Zope (or Python...) enough to work out how to do it...

Zope is a fantastic product but my head is still spinning from the learning
curve...

All help appreciated.

Cheers Adrian

 



=======================================================================
Adrian Blockley (adrian.blockley@environ.wa.gov.au) 
Western Australian Department of Environment Water and Catchment Protection

Address:
Department of Environment Water and Catchment Protection
141 St Georges Tce 
Perth WA 6000

Ph:  +61 8 9222 7165
Fax: +61 8 9321 5184
=======================================================================

Disclaimer:
This e-mail is confidential to the addressee and is the view of the writer, not necessarily that of the Department of Environmental Protection, which accepts no responsibility for the contents.
If you are not the addressee, please notify the Department by return e-mail and delete the message from your system.  You must not disclose or use this information in any way.
No warranty is made that this material is free from computer viruses.