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

Ron Bickers rbickers-dated-1017325654.985942@logicetc.com
Thu, 21 Mar 2002 09:27:35 -0500


> -----Original Message-----
> From: zpt-admin@zope.org [mailto:zpt-admin@zope.org]On Behalf Of seb
> bacon

> <span define="foo python:1">
>      <b tal:define="bar template/foo | default"
>         tal:content="bar">Foo</b>
> </span>
>
> close but no cigar: the above displays the default value.  The variable
> 'foo' has not been pushed onto the 'template' namespace.

When you use tal:define="...", the variable is available in the same
namespace as 'request', 'here', 'template', etc.

So, you get this:

<span define="foo python:1"
  <b tal:define="bar foo | default"
     tal:content="bar">Foo</b>
</span>

That what you're looking for?
_______________________

Ron Bickers
Logic Etc, Inc.