[mod_python] using nested blocks in psp

cloc3 ziapannocchia at gmail.com
Sun Jun 11 08:06:37 EDT 2006


I'm a newbie in python, and I'm fighting against nested blocks in psp.
Thats a little example with a funny behaviour:
[code]
<html>
<form>
<select name="List">
<!--makes a list with a loop -->

<%
for i in range(50, 350, 50):
 if 'List' in form and int(form['List'])==i:
  sel="selected"
 else:
  sel="pippo"
 %><option value="<%=i%>" <%=sel%> ><%=i%> </option>
 <%
%>
</select>
<input type="submit" value="return"/>
</form>
</html>
[/code]
In my intention, the for instruction have to run two operation:
 first: the if instruction
 second: to print the option tag on the html page.

Instead, the real behaviour is depending on the result of the control
in the if:
 if the control is true, the option tag is not printed, and the for
instruction goes to the successive step.
 if the control is false, the option is correctly printed.

I don't understand the reason of this behaviour.
Which is the right way to control the nested block instructions in psp?




More information about the Python-list mailing list