I'm using <dtml-in "_.range(31)"> to loop. What I can't seem to do is use the sequence-number to compare to anything. Is there a special wat that it needs to be reffered to? This is what I'm doing: <dtml-if "variable == sequence-number"> but it keeps error out with: *Error Type: NameError* *Error Value: global name 'sequence' is not defined* TIA Rick * * **
[D. Rick Anderson]
I'm using <dtml-in "_.range(31)"> to loop. What I can't seem to do is use the sequence-number to compare to anything. Is there a special wat that it needs to be reffered to? This is what I'm doing:
<dtml-if "variable == sequence-number">
but it keeps error out with:
*Error Type: NameError* *Error Value: global name 'sequence' is not defined*
Yes, that's a common thing. What's happening is that the expression is being evaluated by Python (all expressions in quotation marks are), but Python does not use a minus sign in variable names and so tries to subtract "number" from "sequence". The usual work-around is to use the alternative form: <dtml-if "variable=_['sequence-number']"> This way, you can get any attibute of the current Zope namespace by name, minus signs or not. Cheers, Tom P
D. Rick Anderson wrote:
I'm using <dtml-in "_.range(31)"> to loop. What I can't seem to do is use the sequence-number to compare to anything. Is there a special wat that it needs to be reffered to? This is what I'm doing:
<dtml-if "variable == sequence-number">
You could write: <dtml-in "_.range(31)" prefix=number> <dtml-if "variable == number_item"> </dtml-in> regards Max M
participants (3)
-
D. Rick Anderson -
Max M -
Thomas B. Passin