[Zope] The logic of the _ variable (Q1959)

Jeffrey Shell Jeffrey@digicool.com
Thu, 16 Sep 1999 14:55:43 -0400


> Here's some basics, to the best of my understanding:
> 
> <dtml-var x> and <dtml-var "_['x']"> should always be 
> identical, and should
> render 'x'.  If 'x' is a function or method, it will be 
> called.  You can
> also spell this <dtml-var "_.getitem('x', 1)">

In some ways right.

<dtml-var expr="_.render(_['x'])"> looks in the current Document
Template namespace for a variable named 'x' and renders it fully.
There's a fair amount of magic to the use of <dtml-var x> (aka <dtml-var
name="x">) if x is a DTML Document/Method that you would otherwise have
to get at with <dtml-var expr="x(_,_.None)">.

<dtml-var expr="_['x']"> does not automatically call a function/method.
It mearly looks up the object with the id of 'x' out of the _ namespace.