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

Roberto Alsina ralsina at netmanagers.com.ar
Tue May 19 08:17:11 EDT 2009


On Tuesday 19 May 2009 07:46:56 jonas wustrack wrote:

> I might be missing something, but why don't you just use

> levelStyles[-1] everywhere instead of levelStyles[2]?


I was trying to make it exactly as the styles reportlab created (thus the
[2]), then I had to use -1 to get the correct leftIndent and never changed the
rest of it ;-)

Indeed if I use [-1] it works.

I still need to tell SVN from 2.3 because we subclass TableOfContents and
there is a

leftColStyle = self.levelStyles[left_col_level]

which needs to be changed to

leftColStyle=self.getLevelStyle(left_col_level)


>

> On Tue, May 19, 2009 at 11:27 AM, Roberto Alsina

>

> <ralsina at netmanagers.com.ar> wrote:

> > 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

> > _______________________________________________

> > reportlab-users mailing list

> > reportlab-users at reportlab.com

> > http://two.pairlist.net/mailman/listinfo/reportlab-users


--
("\''/").__..-''"`-. . 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