[Zope] The XML-dtml notation "&dtml-variable;"

Tony McDonald tony.mcdonald@ncl.ac.uk
Thu, 4 Nov 1999 16:26:07 +0000


At 4:05 pm +0000 4/11/99, Andrew wrote:
>  >
>>  Would something like this be more palatable?
>>
>>      <dtml-var foo default="Empty">
>>
>
>How is this different from the following?
>
><dtml-var foo null="default-value">
>

Because the null part is used if the variable already exists, just 
that it's *value* is None.
The new syntax would make

<dtml-var spam default="0">

be equivalent to

<dtml-if spam>
...do stuff
<dtml-else>
<dtml-call "REQUEST.set('spam', '0')">
</dtml-if>

ie would *create* a variable and set it to a sensible default.

Note that if you try your line of code in a DTML object when foo 
hasn't been set, you'll get a traceback (unless you're using try tags)

Least ways, that's how *I've* interpreted it! :)
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