[reportlab-users] SVN trunk reportlab.Version is the same as 2.3

Roberto Alsina ralsina at netmanagers.com.ar
Tue May 19 06:27:23 EDT 2009


On Tuesday 19 May 2009 05:26:13 jonas wustrack wrote:

> I am a bit surprised that your fix breaks when used with the trunk. My

> change was meant to be backwards compatible.

> If you just added a list of styles to the defaultStyles attribute

> there should be no problem. Can you show me a traceback and possibly

> the source code of your fix?


It's probably that my fix is not exactly awesome code ;-)

My fix:

# Issue 117: add extra TOC levelStyles. 9-deep should be enough.
for i in range(4):
ps=toc.levelStyles[2].__class__(name='Level%d'%(i+5),
parent=toc.levelStyles[2],
leading=toc.levelStyles[2].leading,
firstlineIndent=toc.levelStyles[2].firstLineIndent,
leftIndent=toc.levelStyles[-1].leftIndent+1*cm)
toc.levelStyles.append(ps)

Here is the error:

ps=toc.levelStyles[2].__class__(name='Level%d'%(i+5),
IndexError: list index out of range

I understand in SVN I am supposed to use getLevelStyle(2) instead of
levelStyles[2] but since that's not in 2.3 I still need to catch an exception.

--
("\''/").__..-''"`-. . Roberto Alsina
`9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH)
(_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar
_..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia
(l)-'' ((i).' ((!.' according to alexa.com (27/5/2007)
"Our opponent is an alien starship packed with atomic bombs, I said.
We have a protractor. Okay, I’ll go home and see if I can scrounge up a
ruler and a piece of string." — Neal Stephenson


More information about the reportlab-users mailing list