Bug in get_html_string()

21 views
Skip to first unread message

vmail

unread,
Dec 15, 2009, 6:39:56 AM12/15/09
to prettytable-users
Hi
I think I found a bug :

This code:
t = PrettyTable(['name','type','value'])
t.add_row(['P','P','300'])
t.add_row(['A','MA','400'])

yields this output ( note the mismatched <tr> tag after the second
element

<table border="1">
<tr>
<th style="padding-left: 1em; padding-right: 1em; text-align:
center">name</th>
<th style="padding-left: 1em; padding-right: 1em; text-align:
center">type</th>
<th style="padding-left: 1em; padding-right: 1em; text-align:
center">value</th>
</tr>
<tr>
<td style="padding-left: 1em; padding-right: 1em; text-align:
center">P</td>
<td style="padding-left: 1em; padding-right: 1em; text-align:
center">P</td>
<td style="padding-left: 1em; padding-right: 1em; text-align:
center">300</td>
<tr>
<td style="padding-left: 1em; padding-right: 1em; text-align:
center">A</td>
<td style="padding-left: 1em; padding-right: 1em; text-align:
center">MA</td>
<td style="padding-left: 1em; padding-right: 1em; text-align:
center">400</td>
</tr>
</table>

Luke Maurits

unread,
Dec 17, 2009, 4:06:42 AM12/17/09
to prettyta...@googlegroups.com
This is definitely a bug! Thanks for reporting it.

Thankfully, it's quite easy to fix. Line 878 of prettytable.py needs
to be indented once more so that it is inside the for loop that
iterates over the rows.

I will try to make a new minor release over this weekend which fixes
the bug. In the mean time if you desperately need a working version I'm
afraid you'll just have to make that one little change yourself. If
you need more advice on how to do this, feel free to send me an email
directly to my address.

Regards,
Luke

--
Luke Maurits <lu...@maurits.id.au>
http://www.luke.maurits.id.au
http://www.luke.maurits.id.au/foaf.rdf
CompCogSci | Crypto | Maths | Python | Unix

Reply all
Reply to author
Forward
0 new messages