dtml-in for another folder
Hi This is a very basic question. I have FolderA inside the root folder, and an DTML Method in FolderA: <dtml-var standard_html_header> <ul> <dtml-in objectValues> <li><dtml-var title_or_id></li> </dtml-in> </ul> <dtml-var standard_html_footer> It generates a list of all objects in the folder, ok. Then, I have a FolderB inside FolderA. When I try to do the same thing on that folder (referencing FolderB from FolderA): <dtml-in FolderB/objectValues> that generates a KeyError. The same thing when I try to use a full path: <dtml-in /FolderA/objectValues> I'm sure I've missed something - I thought that I could call any method of any object just by referencing it, but I see that this is not the right way. Thanks, Gabriel Genellina Softlab SRL
----- Original Message ----- From: "Gabriel Genellina" <gagenellina@softlab.com.ar> To: <zope@zope.org> Sent: Thursday, November 29, 2001 19:34 Subject: [Zope] dtml-in for another folder
Hi
This is a very basic question.
I have FolderA inside the root folder, and an DTML Method in FolderA:
<dtml-var standard_html_header> <ul> <dtml-in objectValues> <li><dtml-var title_or_id></li> </dtml-in> </ul> <dtml-var standard_html_footer>
It generates a list of all objects in the folder, ok.
Then, I have a FolderB inside FolderA. When I try to do the same thing on that folder (referencing FolderB from FolderA): <dtml-in FolderB/objectValues> that generates a KeyError. The same thing when I try to use a full path: <dtml-in /FolderA/objectValues>
Try <dtml-in "FolderA.objectValues()"> Andreas
At 19:48 29/11/2001 -0500, you wrote:
The same thing when I try to use a full path: <dtml-in /FolderA/objectValues>
Try <dtml-in "FolderA.objectValues()">
Ok! It works now! Thanks! And, what if I want to reference the root folder? or a parent folder? I feel lost in a sea of documentation... Gabriel Genellina Softlab SRL
----- Original Message ----- From: "Gabriel Genellina" <gagenellina@softlab.com.ar> To: "Andreas Jung" <andreas@andreas-jung.com>; <zope@zope.org> Sent: Thursday, November 29, 2001 20:07 Subject: Re: [Zope] dtml-in for another folder
At 19:48 29/11/2001 -0500, you wrote:
The same thing when I try to use a full path: <dtml-in /FolderA/objectValues>
Try <dtml-in "FolderA.objectValues()">
Ok! It works now! Thanks! And, what if I want to reference the root folder? or a parent folder? I feel lost in a sea of documentation...
You can get the root object by calling getPhysicalRoot(). The parent folder is reachable by PARENTS[0]. See AppendixB of the Zope Book. Or see http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html Section Traversal. Cheers, Andreas
participants (2)
-
Andreas Jung -
Gabriel Genellina