[ZPT] Path expression

Shane Hathaway shane@zope.com
Thu, 18 Apr 2002 22:39:45 -0400


Tom Deprez wrote:
> Hi,
> 
> I've tried every possibility from the Zope Book examples, but I can't get it
> to work.
> 
> Basicly I need to get a variable out of the namespace and if it doesn't
> exists, nothing must happen as in
> 
> tal:content="here/myvar | nothing;"
> 
> however, myvar is dynamic, does I should use:
> 
> tal:content="python:path('here/%s'%myvar')"
> 
> but the problem lies in the fact that when myvar doesn't exists in the
> namespace, I get an error, which may not happen.
> 
> I tried tal:content="python:path('here/%s' % myvar') | nothing", but this
> still gives an error when the variable doesn't exist
> 
> Is there a way to get this working with a valid path expression?

Have you tried:

tal:content="here/?myvar | nothing"

?

I just looked through the documentation and realized this syntax might 
not be fully documented.

Shane