[reportlab-users] Wordaxe 0.3.0, ReportLab 2.2, MultiBuild and splitting error

Robin Becker robin at reportlab.com
Tue Nov 18 10:01:45 EST 2008


Harald Armin Massa wrote:

> Hello,

........ some

> wraps from the build pass before have used up everything)

>

> So MY fix was in doctemplate multibuild:

>

> #clean up so multi-build does not go wrong - the frame

> #packer might have tacked an attribute onto some flowables

> for elem in story:

> if hasattr(elem, '_postponed'):

> del elem._postponed

> if hasattr(elem, '_lines'):

> del elem._lines

>

> to extend the "cleanup" part to also delete the _lines attribute of a

> NewParagraph; together with the _postponed attribut.

>

> So everything works fine ... but I am not sure if this is really the

> best approach, and the NewParagraph split/wrap is quite to challenging

> to really be sure.

>

> That's why I am posting this fix for others to enjoy and for more

> enlightened ones to check:)

>

> Harald

>

great, we have a sort of combined approach now in the trunk with something
called doc._multiBuildEdits which appends to a list of things that need to be
cleaned up. Currently that's keepWithNext stuff and _postponed. That mechanism
requires us to store (operation, object, attributename) tuples at the point
where we know the edit is required to be unwound. This just avoids having to
iterate through the whole story to clean stuff up; the clean up code looks like

#work through any edits
while mbe:
e = mbe.pop(0)
e[0](*e[1:])

It's not clear whether this approach will work for your _lines attribute. In
trunk code at least it's possible for a flowable to get access to the document
context during some phases (using self.doctemplateAttr). If this works you could
do something like

mbe=self._doctemplateAttr('_multiBuildEdits')
mbe((self,delattr,'_lines'))

where self._lines is created.
--
Robin Becker


More information about the reportlab-users mailing list