[Zope] Newbie PARENTS question

Amos Latteier amos@aracnet.com
Wed, 29 Sep 1999 23:27:43 -0700


At 05:27 PM 9/29/99 -0400, Chris Cooke-Johnson wrote:

>I'm trying to reference the folder above from a DTML method. Basically
>what I'm looking for is an equivalent to the the <!--#var id--> which
>will give the id of the parent folder. In the DTML reference I found an
>explanation of the PARENTS attribute with seems to be what I want but
>I'm getting errors with both:
>
><!--#var PARENTS[1]-->
>and
><!--#expr PARENTS[1]-->

These are not legal DTML. To insert an expression you need to do this

  <!--#var expr="PARENTS[1]"-->

or for short,

  <!--#var "PARENTS[1]"-->

Check the DTML User's Guide for more details.

  http://www.zope.org/Documentation/Guides/DTML_doc

Also the Advanced DTML How-To has lots of good info on variable
expressions, and other goodies.

  http://www.zope.org/Documentation/How-To/AdvancedDTML

>Also, is it possible to nest calls? I.E. How can I make:
>
><!--#var <!--#var id--><!--#var_another_method--> --> or similar
>
>In other words how can I make a compound call based on path (or other)
variables?

Hmm. I don't quite understand this question. Perhaps you want to do
something like so,

  <!--#var expr="PARENTS[1].someMethod()"-->

In general in an DTML expression you can write most kind of valid python
expression.

Good luck!

-Amos