escaping html tags during method calls
Hi, i'm very confused by zope's behaviour when calling dtml methods. let's have method m1 that returns <p> hello </p> when i do <dtml-var standard_html_header> <dtml-var "m1"> <dtml-var standard_html_footer> i get: ... <p> hello </p> ... when i do <dtml-var standard_html_header> <dtml-var m1> <dtml-var standard_html_footer> i get ... <p> hello </p> ... which is ok. unfortunatelly i need to call method, that is not in the same directory, parser forces me to use double-quotes. being not satisfied with the result mentioned above (first example) i tried <dtml-var standard_html_header> <dtml-let a="subdir.m1"> <dtml-var a> </dtml-let> <dtml-var standard_html_footer> can someone explain, why does it work that way? regards -dan
When you write <dtml-var m1>, Zope ***calls*** object m1, which is what you want here. When you write <dtml-var "m1">, you have asked Zope to evaluate the Python expression m1. In this case, this gives you the (escaped) string representing the m1 object - in other words, a description of the object, as opposed to the results of calling the object. Sometimes this is what you want, but not here. Writing <dtml-var "m1()"> tells Zope to evaluate the Python expression "m1()", which is what you want because Python will know to call the object if it is callable. Cheers, Tom P [Dan Meszaros]
i'm very confused by zope's behaviour when calling dtml methods.
let's have method m1 that returns <p> hello </p>
when i do <dtml-var standard_html_header> <dtml-var "m1"> <dtml-var standard_html_footer>
i get: ... <p> hello </p> ...
when i do <dtml-var standard_html_header> <dtml-var m1> <dtml-var standard_html_footer>
i get ... <p> hello </p> ...
which is ok. unfortunatelly i need to call method, that is not in the same directory, parser forces me to use double-quotes. being not satisfied with the result mentioned above (first example) i tried
participants (2)
-
Dan Meszaros -
Thomas B. Passin