[Zope] assignment problems

Wei Tao taow@bd748.pku.edu.cn
Tue, 04 Jan 2000 19:35:21 +0800


Martijn Pieters wrote:
> Secondly, what comes after the = sign in the let tag, is either a Zope
> name (same as in <dtml-var name="xxx">), when you don't use quotes, or a
> python expression (same as in <dtml-var expr="xxx">) when you do use
> quotes. In your case, "Size='big'" is interpreted as "Size equals the
> python expression big", where "the python expression big" means the
> value of the variable named big. There's your Key Error. In order to
> assign the string literal 'big' to the variable Size, you'll have to use
> quotes around the word big, either Size='"big"', or (confirming to the
> official HTML way of quoting) Size="'big'".
> 
> With above corrections, you're code should read:
> 
>   <dtml-var standard_html_header>
> 
>   <dtml-let Size="'big'">
>   <dtml-if "Size=='big'"><h1></dtml-if>
>   Hello.
>   <dtml-if "Size=='big'"></h1></dtml-if>
>   </dtml-let>
> 
>   <dtml-var standard_html_footer>
> 

There is a small mistake.
In fact, <dtml-let Size='big'> is interpreted as " Size equals the value of
the variable named 'big' ", not the variable named big.
And <dtml-let Size="big"> is interpreted exactly as <dtml-let Size=big>,
while <dtml-let Size='"big"'> simply doesn't work.

hah, it is rather tricky.