[Zope] zope book - tree error
Sandy Britain
iss01d@bangor.ac.uk
Wed, 21 Feb 2001 00:54:55 +0000
This is a multi-part message in MIME format.
--------------62AF859620EF94A39F263189
Content-Type: multipart/alternative;
boundary="------------BA87F49F25C724DCE01F9FC9"
--------------BA87F49F25C724DCE01F9FC9
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi all,
first I'd like to say thanks to all those who have been very helpful and
answered my previous couple of questions.
This is a weird one -
I am trying to use the tree tag by adapting the code in the Zope book
chapter 7 example.
I want to display only folders containing documents in a tree on a
sidebar on the site home page.
my folder structure in Zope goes:
Root
- MyFolder
- documentsFolder
- docFolder1
- docFolder2
- docFolder3
- docFolder3A
- docFolder3B
and so on..
I have given all the 'docFolder' folder objects a boolean property
'doc_folder' that is set to true.
As suggested in the book I have created a python script with the id of
'docFolders' with the following code:
results=[]
for object in context.objectValues(['Folder']):
if object.hasProperty('doc_folder') and object.doc_folder:
results.append(object)
return results
I then created a dtml method to display the tree called 'libraryMap'.
code as follows:
<p> <a href="&dtml-URL0;?expand_all=1">Expand All</a><br>
 <a href="&dtml-URL0;?collapse_all=1">Collapse All</a>
</p>
<dtml-tree branches="docFolders" skip_unauthorized="1">
<a href="&dtml-absolute_url;" TARGET="text"><dtml-var
title_or_id></a>
</dtml-tree>
Both of these methods are located in the 'documentsFolder' (see Folder
structure above). When I test libraryMap using the view tab in Zope it
works fine (yippee!), but when I add a dtml method in MyFolder to call
the method 'libraryMap' with the following code:
<dtml-with documentsFolder>
<dtml-var libraryMap>
</dtml-with>
All that gets displayed are the two hyperlinks for 'Expand All' and
'Collapse All'. So the tree doesn't seem to be working even though the
method returns with no errors.
Thanks in advance to anyone who can help! :-)
Sandy.
**NB: Interestingly, if I add a test method to the documentsFolder to
call libraryMap simply with <dtml-var libraryMap>
it will work if the test method is a dtml-method, but not if it is a
dtml-document when the same behaviour as described above results!?
--------------BA87F49F25C724DCE01F9FC9
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi all,
<p>first I'd like to say thanks to all those who have been very helpful
and answered my previous couple of questions.
<p>This is a weird one -
<p>I am trying to use the tree tag by adapting the code in the Zope book
chapter 7 example.
<br>I want to display only folders containing documents in a tree
on a sidebar on the site home page.
<p>my folder structure in Zope goes:
<p>Root
<br> - MyFolder
<br> - documentsFolder
<br>
- docFolder1
<br>
- docFolder2
<br>
- docFolder3
<br>
- docFolder3A
<br>
- docFolder3B
<p>and so on..
<br> I have given all the 'docFolder' folder objects a boolean property
'doc_folder' that is set to true.
<br>As suggested in the book I have created a python script with
the id of 'docFolders' with the following code:
<p><tt>results=[]</tt>
<br><tt>for object in context.objectValues(['Folder']):</tt>
<br><tt> if object.hasProperty('doc_folder') and object.doc_folder:</tt>
<br><tt> results.append(object)</tt>
<br><tt>return results</tt>
<p>I then created a dtml method to display the tree called 'libraryMap'.
code as follows:
<br>
<p><tt><p>&nbsp<a href="&dtml-URL0;?expand_all=1">Expand
All</a><br></tt>
<br><tt> &nbsp<a href="&dtml-URL0;?collapse_all=1">Collapse
All</a></tt>
<br><tt></p></tt>
<p><tt><dtml-tree branches="docFolders" skip_unauthorized="1"></tt>
<br><tt> <a href="&dtml-absolute_url;" TARGET="text"><dtml-var
title_or_id></a></tt>
<br><tt></dtml-tree></tt>
<p>Both of these methods are located in the 'documentsFolder' (see Folder
structure above). When I test libraryMap using the view tab
in Zope it works fine (yippee!), but when I add a dtml method in MyFolder
to call the method 'libraryMap' with the following code:
<p><tt><dtml-with documentsFolder></tt>
<br><tt> <dtml-var libraryMap></tt>
<br><tt></dtml-with></tt>
<p>All that gets displayed are the two hyperlinks for 'Expand All' and
'Collapse All'. So the tree doesn't seem to be working even though the
method returns with no errors.
<br>
<p>Thanks in advance to anyone who can help! :-)
<p>Sandy.
<p>**NB: Interestingly, if I add a test method to the documentsFolder
to call libraryMap simply with <tt><dtml-var libraryMap></tt>
<br>it will work if the test method is a dtml-method, but not if
it is a dtml-document when the same behaviour as described above results!?</html>
--------------BA87F49F25C724DCE01F9FC9--
--------------62AF859620EF94A39F263189
Content-Type: text/x-vcard; charset=us-ascii;
name="iss01d.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Sandy Britain
Content-Disposition: attachment;
filename="iss01d.vcf"
begin:vcard
n:Britain;Sandy
x-mozilla-html:FALSE
org:University of Wales - Bangor
version:2.1
email;internet:a.a.britain@bangor.ac.uk
title:Dr
tel;fax:+44 (1248) 361429
tel;work:+44 (1248) 383645
adr;quoted-printable:;;UK IMS Centre=0D=0ADean St.;Bangor;Gwynedd;LL57 2UT;UK
x-mozilla-cpt:;2
fn:Sandy Britain
end:vcard
--------------62AF859620EF94A39F263189--