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

seb bacon seb@jamkit.com
21 Mar 2002 12:23:09 +0000


> >
> >   <span tal:define="thing python:namespace.get('thing', 'defaultval')">
> 
> just yet another pointer: there is something like _.test() in dtml

yes, but 

 <span tal:define="thing python:test(exists(foo), foo, 'default')">

wouln't work because 'exists' isn't python but TALES.

Of course I could do this in a pythonscript, but it feels like the kind
of thing you should be able to do in an expression (i.e. get a value or
a default from the _current_namepace_).

I suppose what I'm asking is, is there the equivalent of DTML's '_' in
ZPT?

seb