[ZPT] TAL Exists: type

Martijn Pieters mj@digicool.com
Wed, 21 Mar 2001 16:28:00 +0100


On Wed, Mar 21, 2001 at 10:00:55AM -0500, Todd Coram wrote:
> Any stories to tell on the undocumented TAL type of "exists:"?  I briefly
> remember this type, but can't remember concisely where it is applicable.
> Any use cases to offer?
> 
> Was it just a hankering or a solution to a recurring problem?

You need it to test for the existence of an object, not just wether or not
the value it returns is true.

This is crucial with REQUEST form fields, for example.

<div tal:condition="exists:request/statusMessage"
     tal:content="request/statusMessage">
     The optional status message will be displayed here
</div>

-- 
Martijn Pieters
| Software Engineer  mailto:mj@digicool.com
| Digital Creations  http://www.digicool.com/
| Creators of Zope   http://www.zope.org/
---------------------------------------------