#14012 closed defect (fixed)

Exception with wiki table

Reported by: Cinc-th Owned by: Cinc-th
Priority: normal Component: TracWikiPrintPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.4


With a wiki page holding a malformed table there is an exception when creating a PDF:

File "/Users/cinc/projects/venvs/Trac-1.4/lib/python2.7/site-packages/trac/web/", line 639, in dispatch_request          
File "/Users/cinc/projects/venvs/Trac-1.4/lib/python2.7/site-packages/trac/web/", line 250, in dispatch          
  resp = chosen_handler.process_request(req)
File "/Users/cinc/projects/venvs/Trac-1.4/lib/python2.7/site-packages/trac/wiki/", line 186, in process_request          
File "/Users/cinc/projects/venvs/Trac-1.4/lib/python2.7/site-packages/trac/mimeview/", line 1020, in send_converted          
File "/Users/cinc/projects/venvs/Trac-1.4/lib/python2.7/site-packages/trac/mimeview/", line 705, in convert_content          
File "/Users/cinc/projects/tracwikiprintplugin/1.4/wikiprint/", line 463, in convert_content          
File "/Users/cinc/projects/tracwikiprintplugin/1.4/wikiprint/", line 301, in html_to_pdf          
File "/Users/cinc/projects/venvs/Trac-1.4/lib/python2.7/site-packages/xhtml2pdf/", line 105, in pisaDocument          
  encoding, context=context, xml_output=xml_output)
File "/Users/cinc/projects/venvs/Trac-1.4/lib/python2.7/site-packages/xhtml2pdf/", line 67, in pisaStory          
  pisaParser(src, context, default_css, xhtml, encoding, xml_output)
File "/Users/cinc/projects/venvs/Trac-1.4/lib/python2.7/site-packages/xhtml2pdf/", line 761, in pisaParser          
  pisaLoop(document, context)
File "/Users/cinc/projects/venvs/Trac-1.4/lib/python2.7/site-packages/xhtml2pdf/", line 699, in pisaLoop          
  pisaLoop(node, context, path, **kw)
File "/Users/cinc/projects/venvs/Trac-1.4/lib/python2.7/site-packages/xhtml2pdf/", line 643, in pisaLoop          
  pisaLoop(nnode, context, path, **kw)
File "/Users/cinc/projects/venvs/Trac-1.4/lib/python2.7/site-packages/xhtml2pdf/", line 643, in pisaLoop          
  pisaLoop(nnode, context, path, **kw)
File "/Users/cinc/projects/venvs/Trac-1.4/lib/python2.7/site-packages/xhtml2pdf/", line 648, in pisaLoop          
File "/Users/cinc/projects/venvs/Trac-1.4/lib/python2.7/site-packages/xhtml2pdf/", line 199, in end          
File "/Users/cinc/projects/venvs/Trac-1.4/lib/python2.7/site-packages/reportlab/platypus/", line 276, in __init__          
  raise ValueError("%s must have at least a row and column" % self.identity())

Example for such a table can be found on WikiFormatting page (last section, Miscellaneous).

This is a minimal test case:

== Broken Table

||= Header 1 =||= Header 2 =||
  TD 1
  TD 2

The last line |---------------------------------- is converted into a table row <tr></tr> without any table cells <td></td> causing the problem.

Attachments (0)

Change History (1)

comment:1 Changed 14 months ago by Cinc-th

Resolution: fixed
Status: assignedclosed

In 18291:

TracWikiPrintPlugin: remove empty<tr></tr> from html before creating pdf. Fixes exception in parsing libs because of missing <td>.

Closes #14012

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Cinc-th.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.