[Zope] python: calling DTML-methods without quoting

Dieter Maurer dieter at handshake.de
Sat Oct 8 06:05:48 EDT 2005


Chris wrote at 2005-10-4 17:00 +0200:
> ...
>If I call a DTML-Method from an other Method (e.g. <dtml-var someDTML>), 
>  HTML entities are not converted.

This calls (renders) the DTML object

>However if I call it from python (e.g. <dtml-var "somePath.someDTML"> 
>the entities are html_quoted.

this does not call (render) the DTML object but means the object itself.
The using environment converts the DTML object into a string by
calling "str". "str(dtmlObject)" returns the object's source -- html quoted.


When you are using Python syntax ("expr" attribute),
you must yourself take care of calling the object (it
happens by magic when you use the "name" attribute (no Python syntax)).

Note, that calling DTML objects yourself has a caveat: you must
pass the two positional arguments "None, _" (in order not
to loose the DTML namespace).

More info in "Calling DTML objects" of

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


-- 
Dieter


More information about the Zope mailing list