[reportlab-users] Bug: keepWithNext in the last flowable triggers an IndexError

Marius Gedminas mgedmin at b4net.lt
Sun Jul 1 13:53:55 EDT 2007


I've encountered this bug with Reportlab 2.0 on Ubuntu Feisty: when the
last item in a document is a title (e.g. imagine a blank page with
"Notes" on top) that has keepWithNext set to True globally in the
paragraph style, platypus throws an IndexError.

I'm attaching a small example that reproduces this. Here's the
traceback it gives me:

Traceback (most recent call last):
File "keep-with-next-error.py", line 18, in <module>
main()
File "keep-with-next-error.py", line 15, in main
SimpleDocTemplate('sample.pdf').build(flowables)
File "/usr/lib/python2.5/site-packages/reportlab/platypus/doctemplate.py", line 870, in build
BaseDocTemplate.build(self,flowables, canvasmaker=canvasmaker)
File "/usr/lib/python2.5/site-packages/reportlab/platypus/doctemplate.py", line 702, in build
self.handle_flowable(flowables)
File "/usr/lib/python2.5/site-packages/reportlab/platypus/doctemplate.py", line 600, in handle_flowable
self.handle_keepWithNext(flowables)
File "/usr/lib/python2.5/site-packages/reportlab/platypus/doctemplate.py", line 577, in handle_keepWithNext
if not getattr(flowables[i],'locChanger',None): i += 1
IndexError: list index out of range

Marius Gedminas
--
<niemeyer> philiKON: I'm changing ZCML to parse files twice as fast..
<philiKON> niemeyer, weee
<benji> ooh, I like it!
<philiKON> how do you do that?
<niemeyer> Lying
<philiKON> i knew it
* benji cries fowl!
-- #zope3-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: keep-with-next-error.py
Type: text/x-python
Size: 454 bytes
Desc: not available
Url : <http://two.pairlist.net/pipermail/reportlab-users/attachments/20070701/b3c5eb3f/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : <http://two.pairlist.net/pipermail/reportlab-users/attachments/20070701/b3c5eb3f/attachment.pgp>


More information about the reportlab-users mailing list