#NEWLINE# def AsHtmlTable( self ) : #NEWLINE# #INDENT# 'Return the results as an HTML table.' #NEWLINE# th = [ ( '<th>%s</th>' % f ) for f in self . fields ] #NEWLINE# headers = ( '<tr>%s</tr>' % '' . join ( th ) ) #NEWLINE# rows = [ ] #NEWLINE# for val in self . results : #NEWLINE# #INDENT# values = [ val [ k ] for k in self . fields ] #NEWLINE# row = [ ( '<td>%s</td>' % f ) for f in values ] #NEWLINE# rows . append ( ( '<tr>%s</tr>' % '' . join ( row ) ) ) #NEWLINE# #UNINDENT# html_out = ( '<table>%s%s</table>' % ( headers , '\n' . join ( rows ) ) ) #NEWLINE# return html_out