I need to detect not only whether a list is empty (that's easy with the #if tag for example), but also whether all of the elements in the list have a property. In Python, one could do this with something like: empty = 1 for element in theList: if not element.hidden: empty = 0 print element if theList and not empty: print "no non-hidden elements" What's the equivalent DTML? Can one create a variable in DTML? Can anyone tell I miss my Python when writing DTML? =)
On Fri, 5 Mar 1999, David Ascher wrote:
What's the equivalent DTML? Can one create a variable in DTML?
<!--# with "_.namespace(empty=1)"--> ... <!--#/with-->
Can anyone tell I miss my Python when writing DTML? =)
I try hard to do everything in DTML but ... python is such a breeze. OTH if you have most of your code written in DTML it is so easy to create similar products and move them around. Pavlos
On Fri, 5 Mar 1999, Pavlos Christoforou wrote:
On Fri, 5 Mar 1999, David Ascher wrote:
What's the equivalent DTML? Can one create a variable in DTML?
<!--# with "_.namespace(empty=1)"--> ... <!--#/with-->
Hmm. I want to create a variable whose value is given by another value. Doing: <!--#with "_.namespace(foo=<!--#var id-->)"--> <!--#var foo--> <!--#/with--> doesn't make it through the parser. I've tried adding various quotes to no effect. I think I'm going to work on understanding ExternalMethods -- this syntax is not made for me. =) --david
On Fri, 5 Mar 1999, David Ascher wrote:
<!--#with "_.namespace(foo=<!--#var id-->)"--> <!--#var foo--> <!--#/with--> doesn't make it through the parser.
I've tried adding various quotes to no effect.
You cannot nest DTML but you can use _[] to access the namespace. For instance you could do: <!--#with "_.namespace(foo=_['id'])"--> Have a nice weekend Pavlos
participants (2)
-
David Ascher -
Pavlos Christoforou