[ZPT] Re: Re: DTML/ZPT examples

Brent Hendricks brentmh@ece.rice.edu
Wed, 13 Jun 2001 17:00:03 -0500


On Wed, Jun 13, 2001 at 07:57:50AM -0500, Lynn Walton wrote:
> >  I would like to propose the following alternative:
> >
> > <H4 tal:content="python:test(len(result)==0, path('template/title'), 'Untitled')">Dummy Title</H4>
> >
> > --Brent
> 
> Brent, thanks for showing this. And Peter, thanks for providing that great examples page.  I couldn't have figured out ZPT nearly as
> well without it.
> I like the method Brent suggested, because in the other method of using two tags with inverse conditions,  you'll see both tags in a
> WSYWIG editor which partially defeats one of the main purposes of ZPT.

I have to agree with you :)

> 
> Now for a possibly dumb newbie question ..... where does  test come from in  python:test ?

test() is a zope-specific python function.  You can find it in the
Zope help system under Zope Help->DTML Reference->functions.  Any of
the functions listed here should be available under ZPT.

Happy coding!

--Brent

-------------------------------------------------------------------------

"The programmer, like the poet, works only slightly removed from pure
 thought-stuff.  He builds his castles in the air, from air, creating
 by exertion of the imagination.  Few media of creation are so
 flexible, so easy to polish and rework, so readily capable of
 realizing grand conceptual structures."
                        -- Frederick Brooks, Jr., The Mythical Man Month