[ZPT] how do I test the existence of a variable?

Thomas Olsen tol@tanghus.dk
Thu, 21 Mar 2002 13:24:09 +0100


On Thursday 21 March 2002 12:56, seb bacon wrote:
>
>   <span tal:define="thing python:namespace.get('thing', 'defaultval')">

What about:

<span tal:define="thing python:exists('thing') and thing or 'defaultval'">

> Cheers,
>
> seb

-- 
Regards,
    Thomas Olsen

http://www.tarpit.dk