I wanted to assign a list object to a tal global variable but I can't seem to find the correct syntax. I tried: <div tal:define="global mylist=['item1', 'item2']" tal:content=""> blah </div> but it doesn't like that syntax. Googling turns up thousands of items that deal with tal but I can't see a simple example of assigning a list object to a variable name. -- David Bear phone: 602-496-0424 fax: 602-496-0955 College of Public Programs/ASU University Center Rm 622 411 N Central Phoenix, AZ 85007-0685 "Beware the IP portfolio, everyone will be suspect of trespassing"
David Bear wrote:
I wanted to assign a list object to a tal global variable but I can't seem to find the correct syntax. I tried:
<div tal:define="global mylist=['item1', 'item2']" tal:content=""> blah </div>
but it doesn't like that syntax. Googling turns up thousands of items that deal with tal but I can't see a simple example of assigning a list object to a variable name.
Im not a tal expert but if you just put everthing inside of .... <div tal:define="python: mylist=[... </div> Your fine.
David H wrote:
David Bear wrote:
I wanted to assign a list object to a tal global variable but I can't seem to find the correct syntax. I tried:
<div tal:define="global mylist=['item1', 'item2']" tal:content=""> blah </div>
but it doesn't like that syntax. Googling turns up thousands of items that deal with tal but I can't see a simple example of assigning a list object to a variable name.
Im not a tal expert but if you just put everthing inside of .... <div tal:define="python: mylist=[...
</div>
Your fine.
ah heck it should be: <div tal:define "someName python: alist[like so] ..." </div> where someName is global inbetween the <div>s and the "global" modifier can be pointless.
David Bear wrote:
I wanted to assign a list object to a tal global variable but I can't seem to find the correct syntax. I tried:
<div tal:define="global mylist=['item1', 'item2']" tal:content=""> blah </div>
<div tal:define="mylist python:['item1', 'item2']" tal:content="mylist"> This will print "['item1', 'item2']" </div>
participants (3)
-
David Bear -
David H -
Philipp von Weitershausen