[Zope] Rendering files with exception

Dieter Maurer dieter@handshake.de
Wed, 3 Jul 2002 20:05:40 +0200


Jaroslav Lukesh writes:
 > I was try to do with WITH tag, but not successfully. So I was
 > try TRY tag
 > 
 > <dtml-try>
 > 		<dtml-var index.htm>
 > <dtml-except>
 > 		<dtml-var standard_html_header>
 > 		<dtml-var sys_list-item>
 > 		<dtml-var standard_html_footer>
 > </dtml-try>
It seems that you would like to render "index.htm" if it exists
in the current folder and do something else, otherwise.

The following code is not completely safe but may be sufficient
for your purposes:

    <dtml-if "_.hasattr(aq_explicit,'index.htm')">
      <dtml-var index.htm>
    <dtml-else>....
    </dtml-if>

If you want to learn more about "aq_explicit", read

  <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>



Dieter