[Zope] tal conditional help

kit BLAKE kitblake at gmail.com
Wed Dec 13 06:39:09 EST 2006


2006/12/12, David Bear <David.Bear at asu.edu>:
> I have a page template that <div> tag to insert another template.
> currently I do
>
> <div content="structure here/form.pt">
>   form template
>  </div>
>
> I rely on the form.pt object to exist in the folder where the template
> is called from. This works okay. However, I think it would be wise to
> put some kind of error checking in the tal to avoid sending some kind
> of exception to the browser.
>
> what I think would be the correct thing is to test if form.pt exists,
> if not do insert nothing, otherwise insert it as above.
>
> However I can't seem to locate any tal syntax that lets me do this.
>
> I found tal:condition but haven't found any examples of using a
> 'exists' type of condition.
>
> Any pointers?

There is an exists expression that you can use in a condition:

http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/AppendixC.stx#3-44


-- 
Kit BLAKE · Infrae · http://infrae.com/ + 31 10 243 7051
Hoevestraat 10 · 3033 GC · Rotterdam + The Netherlands
Contact = http://xri.net/=kitblake


More information about the Zope mailing list