Hi; This is probably a Python question, but I'm using this tag: <!--#var expr="_.whrandom.choice(testimonials.objectValues())"--> When an object is selected it_gets_read_as_ASCII, thus, this line: <select> looks like this: <select> As a result, I can't use HTML! How do I keep it from doing that? TIA, BenO
Hi Ben, assuming, your testimonials are DTML Methods or Documents or something like that, you could modify your call like this: <dtml-var expr="_.whrandom.choice(testimonials.objectValues())(_,_.None)"> or <dtml-let dok="_.whrandom.choice(testimonials.objectValues())"> <dtml-var dok> </dtml-var> This is because you first select only the object. If you use the object without calling it, it renders its "represenation", with other words the method __repr__ is called on the python object. If you call it with () (dtml-methods need a container and Caller, therefore the arguments _ and _.None) the method __call__ however, renders the DTML Document, so you get the resulting HTML rather then the souce code. Of you use <dtml-var object> it is equal to <dtml-var name="object"> in this case, Zope determines if the object is callable and then calls it if so. HTH Tino Wildenhain --On Samstag, 21. Juli 2001 11:07 -0700 Ben Ocean <zope@thewebsons.com> wrote:
Hi; This is probably a Python question, but I'm using this tag: <!--#var expr="_.whrandom.choice(testimonials.objectValues())"--> When an object is selected it_gets_read_as_ASCII, thus, this line:
<select>
looks like this:
<select>
As a result, I can't use HTML! How do I keep it from doing that? TIA, BenO
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Ben Ocean writes:
This is probably a Python question, but I'm using this tag: <!--#var expr="_.whrandom.choice(testimonials.objectValues())"--> When an object is selected it_gets_read_as_ASCII, thus, this line:
<select>
looks like this:
<select> The standard problem of not rendering DTML objects.....
Use: <dtml-var expr="_.render(_.whrandom.choice(testimonials.objectValues())"> Dieter
participants (3)
-
Ben Ocean -
Dieter Maurer -
Tino Wildenhain