[mod_python] using nested blocks in psp

Graham Dumpleton grahamd at dscpl.com.au
Mon Jun 12 04:56:37 EDT 2006


On 12/06/2006, at 6:35 PM, ziapannocchia at gmail.com wrote:

> In the code at the and of the post, the for instruction flux depends
> from the nested if.
>
> Behaviour expected: for any item, the for instruction executes the if
> instruction and
> write the option tag.
>
> Real behaviour: the for instruction runs well only if the control in
> the if instruction fails. If the control is true, the flux jumps to  
> the
> next item and the option tag is not printed on html output.
>
> I need to understand if that depends from a bad indentation or if
> structures with more than one ":" are not supported in psp.
>
> Sorry for my english.
>
> [code]
> <html>
> <form>
> <select name="Elenco">
> <!--genera elenco usando un loop -->
>
> <%
> for i in range(50, 350, 50):
> if 'Elenco' in form and int(form['Elenco'])==i:
>  sel='selected'
> else:
>  sel=''
>  #

If I understand what you want, add:

# end for

at zero indent level.

The "#end for" indent hint was mentioned in link I already sent you in
response to comp.lang.python post.

Graham

> %>
> <option value="<%=i%>" <%=sel%> >
>  <%=i%>
> </option>
> <%
> %>
> </select>
> <input type="submit" value="acquisizione"/>
> </form>
> </html>
> [/code]
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python



More information about the Mod_python mailing list