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

Evan Simpson evan@tokenexchange.com
Thu, 16 Sep 1999 13:15:38 -0500


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)">

<dtml-var "x"> should give a string representation of the contents of 'x'.
If 'x' is a string or number, this is straightforward and the same as
<dtml-var x>.  If 'x' is an object, the result will often be like "<CLASS
instance at ADDRESS>".  Some objects define alternate string
representations; DTML objects simply return their DTML code.  You can also
spell this <dtml-var "_.getitem('x', 0)">

You can get at properties or sub-objects of 'x' using <dtml-with x><dtml-var
y></dtml-with> or <dtml-var "x.y"> or <dtml-var "_.getattr(x, 'y')">.

----- Original Message -----
From: <picasso@videotron.ca>
> I'm trying to have a deeper understanding of the use of the _ variable