[reportlab-users] Simple multibuild doesn't work

Robin Becker robin at reportlab.com
Thu Jun 4 12:06:25 EDT 2009


Roberto Alsina wrote:

> On Thursday 04 June 2009 10:09:02 Robin Becker wrote:

>> Roberto Alsina wrote:

>>> What's wrong with this simple program?

>>>

>>> Here is the code, which is basically the example from the docs,

>>> simplified, and changed from build to multiBuild:

>>>

>>> http://pastebin.com/f5ecf1e1f

>>>

>>> Tried it with reportlab 2.3 and r3492 from svn.

>>>

>>> If I use build() it works, with multiBuild() it fails with this

>>> exception:

>> I suspect that multibuild actually requires some Indexing flowables to

>> work.

>

> If I add a TableOfContents it fails in the exact same way.

>

> http://pastebin.com/f3e11f1d8

>

> Maybe what it needs is a bookmark?

>

> Sorry if this is an unrealistic example.

>

The onPage thing is a property of the document/template classes so the
implication is that something is not setting up properly. I haven't used
multi-build very much so cannot really say. The onPage stuff is supposed to be
set up by SimpleDocTemplate.

I figured out that whoever added multiBuild did it only for the base class. The
build call in there is incompatible with the SimpleDocTemplate. I guess really
that whoever wrote build (that's me) was stupid in allowing build to have any
arguments other than the story.


Anyhow I can make multibuild compatible by making its signature look like this

def multiBuild(self, story,
maxPasses = 10,
**buildKwds
):

then in the body of multiBuild the call to build looks like this

self.build(tempStory, **buildKwds)

that at least allows stuff to proceed.
--
Robin Becker


More information about the reportlab-users mailing list