[ZPT] testing for the existence of a variable

SMITH, KEVIN J. kevin.j.smith@certen.ca
28 Nov 2002 16:44:50 -0500


I am having trouble with the paradigm of ZPT ...

I want to set the value of a variable in ZPT only if it isn't already
set.  The problem is whenever I reference the variable when it has not
been set I get an error.  This sounds so simple but I have tried many
different ways to accomplish this and every time I come up empty handed.

example:  this is what I want to do ...

<span tal:define="language python:test(language, language,
'french')></span>

or in a Perl paradigm:

unless ($language) { $language = "french"; }

Does anybody have an elegant solution to this problem?

Many thanks in advance
Kevin Smith
hawkeesk8@yahoo.com