[reportlab-users] [patch] use hasattr to check lineBreak

Shun-ichi Goto shunichi.goto at gmail.com
Tue Aug 16 01:49:37 EDT 2011


Hi, I'm new to this list.
So sorry if this issue is already discussed.

I've got an error on using rst2pdf with wordWrap = CJK option.
I guess _justifyDrawParaLineX() has a bug at paragraph.py:335
in reportlab 2.5, and also sit in daily snapshot.

diff -r 18a025eed88b src/reportlab/platypus/paragraph.py
--- a/src/reportlab/platypus/paragraph.py Tue Aug 16 14:38:14 2011 +0900
+++ b/src/reportlab/platypus/paragraph.py Tue Aug 16 14:38:54 2011 +0900
@@ -332,7 +332,7 @@
def _justifyDrawParaLineX( tx, offset, line, last=0):
setXPos(tx,offset)
extraSpace = line.extraSpace
- simple = last or abs(extraSpace)<=1e-8 or line.lineBreak
+ simple = last or abs(extraSpace)<=1e-8 or hasattr(line, 'lineBreak')
if not simple:
nSpaces = line.wordCount+sum([_nbspCount(w.text) for w in
line.words if not hasattr(w,'cbDefn')])-1
simple = not nSpaces

--
Shun-ichi GOTO


More information about the reportlab-users mailing list