[mod_python] Nested For Loops

Robert Thomas Davis rdavisunr at yahoo.com
Mon Mar 8 09:10:29 EST 2004

Hello all.  The following code is in a template file which gets passed the "record_set" variable, which is the result from an SQL query.  Its job is to create an table with the query information.  This all works fine, however, I have been unable to figure out where to put the closing tag for the <tr> tag.  According to what I have read it should be placed after the end to the first inner loop.  However, that places </tr> tags after every <td></td> pair.  This is all with the goal in mind of keeping things XHTML complient.  I would appreciate any comments and suggestions.
Thanks everyone.
<table border="1">
<caption><%= caption %></caption>
for record in record_set:
        # begin outer loop
        for field in record:
                # begin inner loop
                <td><%= field %></td>
        # end inner loop
# end outer loop

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.modpython.org/pipermail/mod_python/attachments/20040308/80bf4644/attachment.html

More information about the Mod_python mailing list