[ZPT] If/else?

Guido van Rossum guido@digicool.com
Thu, 10 May 2001 20:53:03 -0500


> Guido van Rossum wrote:
> > 
> > > From: richard@bizarsoftware.com.au
> > > Here's a thought too...
> > >
> > > <div tal:condition="python:exists('a/b/c')"
> > >      tal:replace="a/b/c/d" />
> > >
> > > ... and
> > >
> > > <div tal:replace="a/b/c/d | nothing" />
> > 
> > You mean default rather than nothing.
> 
> No, unless I'm reading things wrong. The intended behaviour of both is to
> replace the tag with "a/b/c/d" if it exists - and nothing if it doesn't.
> Are you saying that isn't what I'd get in the second case?

'nothing' substitutes an empty string.
'default' leaves the sample text from the template in place.

--Guido van Rossum (home page: http://www.python.org/~guido/)