[Zope] Re: [Zope-dev] Rendering of objects in DTML

Dieter Maurer dieter@handshake.de
Mon, 13 Jan 2003 20:42:59 +0100


This question belongs to "zope@zope.org" (not zope-dev).
I redirected the response.

Bjorn Stabell wrote at 2003-1-13 17:29 +0800:
 > When a content is rendered by the Zpublisher, its index_html() is
 > called.  When it is rendered in DTML, e.g., as <dtml-var content>, its
 > __call__ method is called.  The __call__ method is also called if the
 > object appears in <dtml-if content> or <dtml-with content>.  Is it
 > possible to render these two cases differently from <dtml-var content>?
DTML tags support two kinds of object parameters/attributes:

  *  the name attribute
and
  *  the expr attribute

You are using the first kind: it renders the named object (which
means, it calls it when it is callable).

The second kind gives you precise control:

    <dtml-if expr="content"> and <dtml-with expr="content">
is probably what you are looking for.

For more details, please read the "Name lookup section" of

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



Dieter