Package: python-reportlab Version: 2.1dfsg-2 Severity: normal Tags: patch With this layout reportlab crash :
from reportlab.platypus import BaseDocTemplate, Frame, Paragraph, PageTemplate from reportlab.lib.pagesizes import A4, cm from reportlab.lib.styles import getSampleStyleSheet from reportlab.platypus.tables import LongTable import StringIO buf = StringIO.StringIO() frame = Frame(2 * cm, 2 * cm , A4[0] - 4 * cm, A4[1] - 6*cm) doc = BaseDocTemplate(buf, pagesize=A4) doc.addPageTemplates(PageTemplate('i',frame)) style_para = getSampleStyleSheet()['Normal'] style_para.spaceAfter = 12 elements = [] for z in (3,6,3,5,12,7): elements.append(Paragraph('toto',style_para)) elements.append(LongTable([('x') for x in range(z)], repeatRows=1)) doc.build(elements) Traceback (most recent call last): File "lt.py", line 19, in <module> doc.build(elements) File "/usr/lib/python2.5/site-packages/reportlab/platypus/doctemplate.py", line 740, in build self.handle_flowable(flowables) File "/usr/lib/python2.5/site-packages/reportlab/platypus/doctemplate.py", line 651, in handle_flowable S = frame.split(f,self.canv) File "/usr/lib/python2.5/site-packages/reportlab/platypus/frames.py", line 176, in split r = flowable.split(self._aW, y-p-s) File "/usr/lib/python2.5/site-packages/reportlab/platypus/tables.py", line 1152, in split return self._splitRows(availHeight) File "/usr/lib/python2.5/site-packages/reportlab/platypus/tables.py", line 1024, in _splitRows n=self._getFirstPossibleSplitRowPosition(availHeight) File "/usr/lib/python2.5/site-packages/reportlab/platypus/tables.py", line 1140, in _getFirstPossibleSplitRowPosition if h+rh>availHeight: TypeError: unsupported operand type(s) for +: 'int' and 'NoneType' -- System Information: Debian Release: lenny/sid APT prefers testing APT policy: (500, 'testing') Architecture: i386 (i686) Kernel: Linux 2.6.25-2-686 (SMP w/1 CPU core) Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages python-reportlab depends on: ii python 2.5.2-1 An interactive high-level object-o ii python-central 0.6.8 register and build utility for Pyt Versions of packages python-reportlab recommends: ii python-imaging 1.1.6-3 Python Imaging Library pn python-renderpm <none> (no description available) ii ttf-bitstream-vera 1.10-7 The Bitstream Vera family of free ii ttf-dustin 20030517-6 Various TrueType fonts from dustis Versions of packages python-reportlab suggests: ii acroread [pdf-viewer] 8.1.2.su1-0.0 Adobe Acrobat Reader: Portable Doc ii gv [pdf-viewer] 1:3.6.5-2 PostScript and PDF viewer for X pn python-egenix-mxtexttools <none> (no description available) pn python-reportlab-doc <none> (no description available) ii xpdf-reader [pdf-viewer] 3.02-1.3 Portable Document Format (PDF) sui ii xpdf-utils [pdf-viewer] 3.02-1.3 Portable Document Format (PDF) sui -- no debconf information
--- tables.py_orig 2008-08-17 15:00:53.000000000 +0200 +++ tables.py 2008-08-17 15:01:43.000000000 +0200 @@ -1136,6 +1136,7 @@ n = 1 split_at = 0 # from this point of view 0 is the first position where the table may *always* be splitted for rh in self._rowHeights: + rh = rh or 0 if h+rh>availHeight: break if not impossible.has_key(n):