ian
At 01:18 PM 8/4/2003, you wrote:
Ian L wrote: > I have a bit of psp code like this: > > <% > for (obj_id, score) in list: > obj = manager.load(obj_id) # load object %> > <tr><td><%=obj.klassinfo%></td><td><%=score%></td><td><%=obj.g > et_short_info()%></td><td><a > href="search-display.py?id=<%=obj.id%>">view in detail</a></td></tr> > <%end%> > > This all displays the correct info, only it only displays one line. It > should be displaying 50 lines. > > When i put some debug info in the page, like len(list) it came back > with 50, and when i just printed out list, it came back with a list > that contained 50 two item tuples. In our .py page this code works. > Everything else in the psp version of this page seems to work, except > for this for loop. Can anyone tell me what i am doing wrong? > > ian
It's because of the way indentation is handled in PSP. This should work:
<%for (obj_id, score) in list:%> <%obj = manager.load(obj_id) # load object %> <tr> <td><%=obj.klassinfo%></td> <td><%=score%></td> <td><%=obj.get_short_info()%></td> <td><a href="search-display.py?id=<%=obj.id%>">view in detail</a></td> </tr> <%end%>
PSP only indents its generated code if the last line in a block ends with a colon, but the way you wrote your block with both the for line and the next line in the same block, PSP just assumed that you didn't want to indent the code after that block. By moving the for statement into its own set of <% %> with the last character being a colon, it makes the following lines get indented, as you want.
- Geoff
------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss
