[Zope] Quotes and DTML

Passin, Tom tpassin@mitretek.org
Fri, 9 May 2003 13:12:32 -0400


[ Wim Bekker]
>=20
> What are quotes doing here:
>=20
> 1: <dtml-var propertyValues>
> 2: <dtml-var propertyValues()>
> 3: <dtml-var "propertyValues">
> 4: <dtml-var "propertyValues()">
>=20
> 1 and 4 gives the same result.
> 2 gives Error Type: KeyError; Error Value: propertyValues().
> 3 gives a >
>=20

(1) calls propertyValues() if it is callable - in this case it is, so
the result is the same as (4) -  otherwise  it gets the value of
propertyValue if it has one.=20

(2) is a DTML  error because an object cannot have a name that includes
"()".

An expression in double quotes is evaluated as a Python expression and
the results displayed.  In Python, propertyValues (without any
parentheses) returns the Python object of that name.  If that object is
a function, it is not called (because the "()" are missing), just
returned as an object.  How that object is displayed depends on the type
of object. Python and DTML access the same collection of objects (since
DTML is using Python to do its accessing).

Cheers,

Tom P