[reportlab-users] Empty lists in table datas

Jean-François Gosset jfg at netinfo.fr
Wed Mar 16 03:49:05 EST 2005


Class reportlab.platypus.tables.Table accepts in parameter "data":

o a string
o a unique flowable
o list of flowables

In this last case, if the list is empty, there is an error during the build.
I know, it seem's stupid to give an empty list. But it could be the case if we generate this list from variable length data collections.
A simple workaround: data = ...., mylist or "", ...

But the definitive correction seems trivial: 2 lines to change in order to test if the list is empty or no ...

against tables.py v2512 :

<         return w, t - V[0].getSpaceBefore()-V[-1].getSpaceAfter()
>         if not V : 
>             return w, t
>         else :
>             return w, t - V[0].getSpaceBefore()-V[-1].getSpaceAfter()
<             y = y+cellval[0].getSpaceBefore()
>             if cellval :
>                 y = y+cellval[0].getSpaceBefore()

jf gosset

More information about the reportlab-users mailing list