Storing a list of numbers in a property
Hi Zope-sters, Can anyone tell me how to store a list in a property in a property_sheet in a zclass instance? What I want is to have a property (lets say its called grades). So I can <dtml-with student> <dtml-in grades> Homework: <dtml-var sequence-item> </dtml-in> </dtml-with> Which should loop through the grades list and print them out. The thing is: I can't figure out what kind of property to use. If I use a string and stick 23, 45, 67 in it then I get an error that you can't use strings with an dtml-in. I tried using "token" and "lines"(I'm not actually sure what these are). This worked but I was unable to math with the entries. I get the error: number coercion failed When I try to do something like this: <dtml-let value=sequence-item> <dtml-call "REQUEST.set('total',total+value)"> Any hints? -Chris Walter walter@budoe.bu.edu
Chris Walter wrote:
I tried using "token" and "lines"(I'm not actually sure what these are). This worked but I was unable to math with the entries.
"tokens" and "lines" properties both store lists of strings, with the requirements that "tokens" elements not contain whitespace and "lines" elements not contain newlines. In either case, you can get an integer value suitable for math by using "_.int()", as in: <dtml-var "_.int(v)+3">
participants (2)
-
Chris Walter -
Evan Simpson