[reportlab-users] table.py None variable error
Nils Smeds
nils.smeds at gmail.com
Tue Mar 20 10:09:35 EDT 2012
In my version of reportlab the following code change was needed. This
happened when I moved from one Fedora Core 14 to Fedeora Core 16.
The array V[] apparently contains None values in some instances in my
application. I notice that in Fedora Core 14 the offending line has been
commented out altogether and replaced by " t = 0 ". So apparently this
problem has bitten others too....
Not sure which solution that is the most correct one, but something needs
to be changed in the source as I understands it.
/Nils
$ diff -p /usr/lib64/python2.7/site-packages/reportlab/platypus/tables.py
/usr/lib64/python2.7/site-packages/reportlab/platypus/tables.py-orig
*** /usr/lib64/python2.7/site-packages/reportlab/platypus/tables.py
2012-03-20 14:51:29.242188950 +0100
--- /usr/lib64/python2.7/site-packages/reportlab/platypus/tables.py-orig
2011-02-09 08:34:11.000000000 +0100
*************** def spanFixDim(V0,V,spanCons,lim=None,FU
*** 202,208 ****
for (x0,x1),v in spanCons.iteritems():
if x0>=lim: continue
x1 += 1
! t = sum([ (V[x] or 0) +M.get(x,0) for x in xrange(x0,x1)])
if t>=v-FUZZ: continue #already good enough
X = [x for x in xrange(x0,x1) if V0[x] is None] #variable
candidates
if not X: continue #something wrong here mate
--- 202,208 ----
for (x0,x1),v in spanCons.iteritems():
if x0>=lim: continue
x1 += 1
! t = sum([V[x]+M.get(x,0) for x in xrange(x0,x1)])
if t>=v-FUZZ: continue #already good enough
X = [x for x in xrange(x0,x1) if V0[x] is None] #variable
candidates
if not X: continue #something wrong here mate
$ rpm -qif /usr/lib64/python2.7/site-packages/reportlab/platypus/tables.py
Name : python-reportlab
Version : 2.5
Release : 3.fc15
Architecture: x86_64
Install Date: Thu 22 Dec 2011 12:57:32 AM CET
Group : Development/Libraries
Size : 5699661
License : BSD
Signature : RSA/SHA256, Fri 29 Jul 2011 03:34:28 PM CEST, Key ID
067f00b6a82ba4b7
Source RPM : python-reportlab-2.5-3.fc15.src.rpm
Build Date : Wed 09 Feb 2011 08:34:41 AM CET
Build Host : x86-12.phx2.fedoraproject.org
Relocations : (not relocatable)
Packager : Fedora Project
Vendor : Fedora Project
URL : http://www.reportlab.org/
Summary : Python PDF generation library
Description :
Python PDF generation library.
$ head /usr/lib64/python2.7/site-packages/reportlab/platypus/tables.py
#Copyright ReportLab Europe Ltd. 2000-2004
#see license.txt for license details
#history
http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/platypus/tables.py
__version__=''' $Id: tables.py 3797 2010-10-01 09:09:33Z rgbecker $ '''
__doc__="""
Tables are created by passing the constructor a tuple of column widths, a
tuple of row heights and the data in
row order. Drawing of the table can be controlled by using a TableStyle
instance. This allows control of the
color and weight of the lines (if any), and the font, alignment and padding
of the text.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20120320/94b11865/attachment.htm>
More information about the reportlab-users
mailing list