[reportlab-users] doc.build empties "story"

Tim Roberts timr at probo.com
Wed Jan 4 14:58:44 EST 2012


Michael Hipp wrote:

> I've been doing this sort of thing forever:

>

> doc = SimpleDocTemplate(self.output, pagesize=page_size,

> showBoundary=boundary)

> doc.build(self.story)

>

> self.story is a python list. But what has started happening is that after that

> 'build' call the story is empty. All items have been removed - an empty list. I

> don't ever remember it doing that before. Is this expected behavior?


Yes. doctemplate.build consumes the items in that list and does not
exit until the list is empty. See doctemplate.py, handle_flowable:
f = flowables[0]
del flowables[0]

--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the reportlab-users mailing list