[Zope] The let Tag.

Tony McDonald tony.mcdonald@ncl.ac.uk
Wed, 15 Sep 1999 17:22:14 +0100


At 11:20 am -0400 15/9/99, picasso@videotron.ca wrote:
>I tried to follow the example of a let tag in "DTML User's Guide". I tried
>made a DTML Method with the following code:
>
><dtml-in "1,2,3,4">
><dtml-let num=sequence-item
>          index=sequence-index
>          result="num*index"
><dtml-var num> * <dtml-var index> = <dtml-var result>
></dtml-let>
></dtml-in>

This works...

<dtml-in "1,2,3,6,7">
<dtml-let num=sequence-item
		idx=sequence-index
		top="num*idx">
<dtml-var sequence-item>,<dtml-var top><br>
</dtml-let>
</dtml-in>

o/p
1,0
2,2
3,6
6,18
7,28


>When I click on Change, I have the message:
>invalid parameter: "
>
>Similarly, I tried the example in the HOW-TO: let Tag:
>
><dtml-let name="bob">
>          relation="uncle"
>   <dtml-var name> is your <dtml-var relation>
></dtml-let>
>
>I can click on Change, the problem is when I go the URL of the method, I
>get message:
>
>Zope Error
>Zope has encountered an error while publishing this resource.
>
>Error Type: NameError
>Error Value: bob
>

bob & uncle need quoting, otherwise the let tag thinks you're giving 
it another name to lookup, hence the NameError
 
This works too...

<dtml-let name="'bob'"
    relation="'uncle'">
<dtml-var name> is your <dtml-var relation>
</dtml-let>

o/p
bob is your uncle

Note Evans' comments about using 'name' as a variable name however...

hth
Tone
------
Dr Tony McDonald,  FMCC, Networked Learning Environments Project 
http://nle.ncl.ac.uk/
The Medical School, Newcastle University Tel: +44 191 222 5888
Fingerprint: 3450 876D FA41 B926 D3DD  F8C3 F2D0 C3B9 8B38 18A2