[reportlab-users] SVN trunk reportlab.Version is the same as 2.3
    jonas wustrack 
    jonas at reportlab.com
       
    Tue May 19 06:46:56 EDT 2009
    
    
  
I might be missing something, but why don't you just use
levelStyles[-1] everywhere instead of levelStyles[2]?
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
>
-- 
Jonas Wustrack
Software Developer
ReportLab Europe Ltd.
Media House, 3 Palmerston Road, Wimbledon, London SW19 1PG, UK
Tel +44-20-8545-1570
    
    
More information about the reportlab-users
mailing list