Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

The heart is not a logical organ. -- Dr. Janet Wallace, "The Deadly Years", stardate 3479.4


devel / comp.lang.python / Re: Reportlab / platypus bug?

SubjectAuthor
* Re: Reportlab / platypus bug?Les
`- Re: Reportlab / platypus bug?Les

1
Re: Reportlab / platypus bug?

<mailman.299.1647281866.2329.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=17503&group=comp.lang.python#17503

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: nagy...@gmail.com (Les)
Newsgroups: comp.lang.python
Subject: Re: Reportlab / platypus bug?
Date: Mon, 14 Mar 2022 19:17:31 +0100
Lines: 175
Message-ID: <mailman.299.1647281866.2329.python-list@python.org>
References: <CAKXe9UALi+jOEFfv9cS6QvRRvy8ssEoVDEx+y5u8OpHCNEMp9A@mail.gmail.com>
<BN8PR14MB28512DF8C49A3E16DA815D11F50F9@BN8PR14MB2851.namprd14.prod.outlook.com>
<CAKXe9UCyCH3PyAxK4-5knt7rrims8_zcjGzxh7JGHNj-ef=Vaw@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de ajSfncXBwdu5IhxoMZGQWw9ioKFURtzN8M+W6QkEDT5g==
Return-Path: <nagylzs@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=hK6E3Xc+;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'def': 0.04; 'traceback':
0.04; '(e.g.': 0.05; '(most': 0.05; '2022': 0.05; 'issue.': 0.05;
'joseph': 0.05; 'last):': 0.05; 'windows,': 0.05; 'world"': 0.05;
'"hello': 0.07; 'explanation': 0.07; 'matplotlib': 0.07;
'telling': 0.07; 'template': 0.07; 'amd64': 0.09; 'cc:addr:python-
list': 0.09; 'example.': 0.09; 'identical': 0.09; 'paragraph':
0.09; 'received:209.85.219': 0.09; 'rendering': 0.09;
'subject:bug': 0.09; 'well:': 0.09; 'cc:no real name:2**0': 0.14;
'import': 0.15; 'url:mailman': 0.15; '%s"': 0.16; '72)': 0.16;
'doc': 0.16; 'docs.': 0.16; 'ezt': 0.16; 'independent,': 0.16;
'laszlo': 0.16; 'once.': 0.16; 'problems:': 0.16; 'render': 0.16;
'reportlab': 0.16; 'scipy,': 0.16; 'skip:t 70': 0.16; 'solves':
0.16; 'title)': 0.16; 'turns': 0.16; 'url:doc': 0.16;
'\xc2\xa0is': 0.16; 'problem': 0.16; 'python': 0.16; 'uses': 0.19;
'cc:addr:python.org': 0.20; 'language': 0.21; 'doubt': 0.22;
'maybe': 0.22; 'version': 0.23; 'idea': 0.24; 'skip:- 10': 0.25;
'url-ip:188.166.95.178/32': 0.25; 'url-ip:188.166.95/24': 0.25;
'url:listinfo': 0.25; 'cannot': 0.25; 'cc:2**0': 0.25; 'url-
ip:188.166/16': 0.25; 'sensitive': 0.26; 'environment': 0.29;
'error': 0.29; 'code,': 0.31; 'raise': 0.31; 'url-ip:188/8': 0.31;
'think': 0.32; 'question': 0.32; '13,': 0.32; 'empty': 0.32;
'happening': 0.32; 'realize': 0.32; 'white': 0.32; 'message-
id:@mail.gmail.com': 0.32; 'but': 0.32; 'mailing': 0.33; 'there':
0.33; 'march': 0.33; 'skip:" 20': 0.34; 'header:In-Reply-To:1':
0.34; 'received:google.com': 0.34; 'question.': 0.35;
'from:addr:gmail.com': 0.35; 'files': 0.36; 'possibly': 0.36;
'thanks,': 0.36; 'change': 0.36; 'received:209.85': 0.37; 'hard':
0.37; 'this.': 0.37; 'file': 0.38; 'error,': 0.38; 'received:209':
0.39; 'two': 0.39; 'single': 0.39; 'list': 0.39; 'explain': 0.40;
'url:page': 0.40; 'years.': 0.40; 'both': 0.40; 'something': 0.40;
'hello,': 0.40; 'try': 0.40; 'paid': 0.61; 'skip:b 30': 0.61;
'skip:h 10': 0.61; 'from:': 0.62; 'to:': 0.62; 'generation': 0.62;
'here': 0.62; 'skip:o 20': 0.63; 'copy': 0.63; 'skip:m 20': 0.63;
'skip:r 20': 0.64; 'skip:r 40': 0.64; 'pay': 0.65; 'skip:t 20':
0.66; 'stories': 0.69; 'skip:t 60': 0.70; 'interesting': 0.71;
'skip:f 20': 0.75; '&quot;': 0.76; 'business': 0.77; 'sent:':
0.78; 'happens': 0.84; '(that': 0.84; '0.2': 0.84; '2022.': 0.84;
'skip:" 90': 0.84; 'skip:& 100': 0.84; 'styles': 0.84;
'surprised': 0.84; 'world&quot;': 0.84; 'les': 0.88; 'inch': 0.91;
'question?': 0.91; 'somebody': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to
:cc; bh=YuEazsapC0q2t+Jf8o6G7gLnufucgUav/ckXp0PJeKU=;
b=hK6E3Xc+TyNsoQYHaD8y5JDr2a2elRt7+OIksqTlQdn6EN1K6uYHqbmFkvfviqrHqW
oez/+G50dAgjy8KgTt2Bk2HpyhTJc0ksWAEBjmlVc27i1A+CaIjAhZYbttzxuzGBNf4W
Y2Aj/B41/3Mb8s48wVby2HRBPityC7QlYq9vLpGr9Hys7FGkaX+cboi8E1CJOKbQdrPY
tFKqUYgCtR4Nr3cPCS9t4tLAwBP1bCwZEvYcVTFkibHLIciMhZ2aSM2AMdShMjIBWIIi
IIxCrhiZ1eJ2LPVNf8NL781qauAVlLse1bfbYRI0JpAlnDg8nRAz9ODO52KdpG9I9EhQ
60BA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:cc;
bh=YuEazsapC0q2t+Jf8o6G7gLnufucgUav/ckXp0PJeKU=;
b=TZuKYGNoqC3HJtah/mvtTIxAx5jOK1twSrk6KkGNuyv2cINkmuLTbNfFjRw30ebPz2
4XSf3VNXVvnzlKu7XmsOI9zlp1rKWzeqSuCqfK4OLC3Slowpg2Cj5zQ/KaGX1xVxMYPL
5ii0R1tQY/dOD1zJs8v42I6cAoHMgry+8Y/5Z2dObWe8/9FCSeEhyKLUK+92HscI575E
9G/4orVntyePtitU8ed/aQIZUa8PJCH2yRClKczkrugRlUcZh7+Gq/vfqgitxizckzoT
Jprq5uZC0eOmVhDcHnrqr4V1HPalzHE81XfC02cslbrlJE74s9TmtL/NuSpey9IRnapQ
4Yeg==
X-Gm-Message-State: AOAM532WDU3aK74Sfb2f+Cuy0jCfLlkFkhn1x94zEl2yvK+FHv9cgDFw
vhSfaM35fD1Y1zYGSZ2yQiZdIQ80dZKfZqifku5CslW/la4=
X-Google-Smtp-Source: ABdhPJy2FYtFw3utxvkoSHbp3E/0pjuw9DVRdjBYGfs3ntk+1AuyXGq/KYkyGr2SIOvgBYNZX8WnmRVWLlYueytRhqQ=
X-Received: by 2002:a05:6214:23c5:b0:433:a53:da7 with SMTP id
hr5-20020a05621423c500b004330a530da7mr18399449qvb.127.1647281863262; Mon, 14
Mar 2022 11:17:43 -0700 (PDT)
In-Reply-To: <BN8PR14MB28512DF8C49A3E16DA815D11F50F9@BN8PR14MB2851.namprd14.prod.outlook.com>
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAKXe9UCyCH3PyAxK4-5knt7rrims8_zcjGzxh7JGHNj-ef=Vaw@mail.gmail.com>
X-Mailman-Original-References: <CAKXe9UALi+jOEFfv9cS6QvRRvy8ssEoVDEx+y5u8OpHCNEMp9A@mail.gmail.com>
<BN8PR14MB28512DF8C49A3E16DA815D11F50F9@BN8PR14MB2851.namprd14.prod.outlook.com>
 by: Les - Mon, 14 Mar 2022 18:17 UTC

Unfortunately, the reportlab-users mailing list is unavailable (I cannot
subscribe). There is paid support but since I already have a workaround, I
won't pay for this. I think this is a documentation error of the reportlab
package. (They do not mention that stories cannot be reused.)

I think we can say that my original problem is solved, because I have a
workaround that always works.

Schachner, Joseph <Joseph.Schachner@teledyne.com> ezt írta (időpont: 2022.
márc. 14., H 19:09):

> I realize this is Python code, but I doubt that the question is a Python
> question. I have used Python +numpy, scipy, matplotlib for years. I have
> not used reportlab and have no idea about the reported problem except that
> I will be very surprised if it turns out to be a Python language issue.
> Is there possibly a better place to ask this question?
>
>
> Teledyne Confidential; Commercially Sensitive Business Data
>
> -----Original Message-----
> From: Les <nagylzs@gmail.com>
> Sent: Sunday, March 13, 2022 4:56 PM
> To: python-list@python.org
> Subject: Reportlab / platypus bug?
>
> Hello,
>
> I have found an error, and I created a minimal working example. The
> minimal working example starts with the very first example from Platypus
> user guide:
>
> from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer from
> reportlab.lib.styles import getSampleStyleSheet from
> reportlab.lib.pagesizes import A4 from reportlab.lib.units import inch
>
> PAGE_HEIGHT = A4[1]
> PAGE_WIDTH = A4[0]
> styles = getSampleStyleSheet()
>
> Title = "Hello world"
> pageinfo = "platypus example"
>
>
> def myFirstPage(canvas, doc):
> canvas.saveState()
> canvas.setFont('Times-Bold', 16)
> canvas.drawCentredString(PAGE_WIDTH / 2.0, PAGE_HEIGHT - 108, Title)
> canvas.setFont('Times-Roman', 9)
> canvas.drawString(inch, 0.75 * inch, "First Page / %s" % pageinfo)
> canvas.restoreState()
>
>
> def myLaterPages(canvas, doc):
> canvas.saveState()
> canvas.setFont('Times-Roman', 9)
> canvas.drawString(inch, 0.75 * inch, "Page %d %s" % (doc.page,
> pageinfo))
> canvas.restoreState()
>
>
> def go():
> Story = [Spacer(1, 2 * inch)]
> style = styles["Normal"]
> for i in range(100):
> bogustext = ("This is Paragraph number %s. " % i) * 20
> p = Paragraph(bogustext, style)
> Story.append(p)
> Story.append(Spacer(1, 0.2 * inch))
> doc = SimpleDocTemplate("phello.pdf")
> doc.build(Story, onFirstPage=myFirstPage, onLaterPages=myLaterPages)
>
>
> go()
>
>
> If I change it to this (e.g. generate two identical files):
>
> doc = SimpleDocTemplate("phello.pdf")
> doc.build(Story, onFirstPage=myFirstPage, onLaterPages=myLaterPages) doc > SimpleDocTemplate("phello2.pdf") doc.build(Story, onFirstPage=myFirstPage,
> onLaterPages=myLaterPages)
>
>
> then it builds phello.pdf correctly, but builds a totally empty phello2.pdf
> (960 bytes, a single white empty page).
>
> It is hard to explain as it is, but something even more interesting
> happens if you try to make them totally independent, and create a copy of
> the story as well:
>
> import copy
> doc = SimpleDocTemplate("phello.pdf")
> doc.build(copy.copy(Story), onFirstPage=myFirstPage,
> onLaterPages=myLaterPages) doc = SimpleDocTemplate("phello2.pdf")
> doc.build(copy.copy(Story), onFirstPage=myFirstPage,
> onLaterPages=myLaterPages)
>
>
> This will render phello.pdf correctly, and it will throw this error when
> rendering phello2.pdf:
>
> Traceback (most recent call last):
> File "C:\Projects\test\test2.py", line 48, in <module>
> go()
> File "C:\Projects\test\test2.py", line 45, in go
> doc.build(copy.copy(Story), onFirstPage=myFirstPage,
> onLaterPages=myLaterPages)
> File
>
> "C:\Users\nagyl\.virtualenvs\test-NC9-O-tN\lib\site-packages\reportlab\platypus\doctemplate.py",
> line 1314, in build
> BaseDocTemplate.build(self,flowables, canvasmaker=canvasmaker)
> File "C:\Users\nagyl\.virtualenvs\
> test-NC9-O-tN\lib\site-packages\reportlab\platypus\doctemplate.py", line
> 1079, in build
> self.handle_flowable(flowables)
> File "C:\Users\nagyl\.virtualenvs\
> test-NC9-O-tN\lib\site-packages\reportlab\platypus\doctemplate.py", line
> 958, in handle_flowable
> raise LayoutError(ident)
> reportlab.platypus.doctemplate.LayoutError: Flowable <Paragraph at
> 0x148e102cb80 frame=normal>This is Paragraph number 6. This is Paragraph
> number 6. This(439.27559055118115 x 72) too large on page 1 in frame
> 'normal'(439.27559055118115 x 685.8897637795277) of template 'First'
>
> And finally, here is the "solution" that solves all problems:
>
>
> def go():
> def create_story():
> Story = [Spacer(1, 2 * inch)]
> style = styles["Normal"]
> for i in range(100):
> bogustext = ("This is Paragraph number %s. " % i) * 20
> p = Paragraph(bogustext, style)
> Story.append(p)
> Story.append(Spacer(1, 0.2 * inch))
> return Story
>
> doc = SimpleDocTemplate("phello.pdf")
> doc.build(create_story(), onFirstPage=myFirstPage,
> onLaterPages=myLaterPages)
> doc = SimpleDocTemplate("phello2.pdf")
> doc.build(create_story(), onFirstPage=myFirstPage,
> onLaterPages=myLaterPages)
>
>
> This does not throw an error, and it renders both files correctly. But I
> do not see why this last version works, and the previous one (that uses
> copy.copy) does not.
>
> I was looking for an explanation in the user guide. I was looking for a
> note, telling me that a story can be used for document generation only
> once. But there is no such thing in the docs. Or maybe I just did not find
> it. Can somebody please explain what is happening here?
>
> Environment details: Python 3.10.1 amd64 on Windows, reportlab 3.6.6
>
> Thanks,
>
> Laszlo
> --
> https://mail.python.org/mailman/listinfo/python-list
>

Re: Reportlab / platypus bug?

<mailman.304.1647346302.2329.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=17510&group=comp.lang.python#17510

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: nagy...@gmail.com (Les)
Newsgroups: comp.lang.python
Subject: Re: Reportlab / platypus bug?
Date: Tue, 15 Mar 2022 13:11:28 +0100
Lines: 52
Message-ID: <mailman.304.1647346302.2329.python-list@python.org>
References: <CAKXe9UALi+jOEFfv9cS6QvRRvy8ssEoVDEx+y5u8OpHCNEMp9A@mail.gmail.com>
<BN8PR14MB28512DF8C49A3E16DA815D11F50F9@BN8PR14MB2851.namprd14.prod.outlook.com>
<CAKXe9UCyCH3PyAxK4-5knt7rrims8_zcjGzxh7JGHNj-ef=Vaw@mail.gmail.com>
<mailman.299.1647281866.2329.python-list@python.org>
<2e3v2h1qblv12ipkqtj55rkv2v2oobgu5v@4ax.com>
<CAKXe9UCWMSdN67OKUXFRW+nBhQhfqUH=NeqSRed53S089znhSQ@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de NcZNwsxox4I+cq/g0DAXgwvOa+eNahRcBwHhJCz3BZGg==
Return-Path: <nagylzs@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=MsCN7cs7;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.012
X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'url-ip:140.82/16': 0.03;
'(e.g.': 0.05; '2022': 0.05; 'mar': 0.07; 'used.': 0.07; '"""':
0.09; 'cc:addr:python-list': 0.09; 'subject:bug': 0.09;
'url:master': 0.09; '&gt;': 0.14; 'cc:no real name:2**0': 0.14;
'url:github': 0.14; 'url-ip:140/8': 0.15; '980': 0.16;
'behaviour': 0.16; 'ezt': 0.16; 'frames': 0.16; 'generating':
0.16; 'once.': 0.16; 'reportlab': 0.16; 'reused': 0.16; 'skip:>
10': 0.16; 'uses': 0.19; 'cc:addr:python.org': 0.20; 'code': 0.23;
'section': 0.25; 'cannot': 0.25; 'cc:2**0': 0.25; 'space': 0.26;
'error': 0.29; 'received:209.85.160': 0.31; 'think': 0.32;
'official': 0.32; 'passes': 0.32; 'message-id:@mail.gmail.com':
0.32; 'but': 0.32; 'mailing': 0.33; 'there': 0.33; 'particular':
0.33; 'same': 0.34; 'mean': 0.34; 'header:In-Reply-To:1': 0.34;
'received:google.com': 0.34; 'runs': 0.35; 'from:addr:gmail.com':
0.35; 'built': 0.36; 'mon,': 0.36; 'guide': 0.37; 'special': 0.37;
'using': 0.37; 'received:209.85': 0.37; 'this.': 0.37; 'could':
0.38; 'received:209': 0.39; 'list': 0.39; 'use': 0.39; 'break':
0.39; 'still': 0.40; 'paid': 0.61; 'url:pdf': 0.62; 'copy': 0.63;
'down': 0.64; 'remains': 0.64; 'documents': 0.65; 'pay': 0.65;
'order': 0.69; 'created.': 0.69; 'following:': 0.69; 'sequence':
0.69; 'stories': 0.69; 'interesting': 0.71; 'near': 0.76; '2022.':
0.84; 'consumed': 0.84; 'passes.': 0.84; 'url:src': 0.84; 'les':
0.88; 'documents.': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to
:cc; bh=xBsVZnwY/SNZ7QiA8EyOcNXVl8hImEZVt9umZzgOuHo=;
b=MsCN7cs7pOdZJvUCcrcfrsYbxvY53coRTykij12E3V/lQ4hLzJx2FjuVTz29pCctX2
MTEUf3wJsLS65agB6jhMNBEB2gZ8ljhxg9AwOjnyN7TuUNe3ShrItpj/My5d4KGsN//p
ohKoEInO5rB7QXy6/QoMiNh6/TMYflMk26Q5eReRluh5iIZpaS8mAM2QRZQ95FHaEWd5
DQVJ6XcNzfw3AsRtD+VdZLlkh03OzIBH9Q0tUSly0UU1hbQU6KXZotfr8JB3Bzh/aK9y
3Ppx5mEeKao4KIdCTgQ+Ln3b7ckqbTK6LvanYe3c4wXCGzorYOlhRA4k+ZKofcrBiNHF
8u5A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:cc;
bh=xBsVZnwY/SNZ7QiA8EyOcNXVl8hImEZVt9umZzgOuHo=;
b=4egb5xMKbNfe04+frZ3/UFGbKWC6FzNcGa5ha0vZxife2BSG/ViTSE5c2zgmQp4gIi
/p0MnjRRPx1XwqBAt4JNj30/2B42Xhn0hcQA7DuQHPzGXYkClIIBwWI4L2Aa/mxoOqyh
ZoaAIWCoUhzAgVb0XLGVO1CYSVYtR/LM5/JGX0vLVBc66GdmqYsRetNgcgotPZ8q/gj3
EuEfhSuT/T6EZEKJUnASwxOlvdNSwihPXcWwPGxenzhbvtmK/rMtjoScKneO3m6b+x93
GmlTUBPcOGsdYZq7x+LTkhphOYfJXEbazAwbMrOxuzw6WjfK0wxTR8S2w+eUHdHe3GrX
jxxA==
X-Gm-Message-State: AOAM532t0M9sujCtI4u0kv/ke4UATqaxORz1UdT3UlmnwjcGHgKNMOzK
ufTrHYAgitnKala6BUuckmgV1KVzXTfhly/2kAYWTRBMstCzIQ==
X-Google-Smtp-Source: ABdhPJzFXBgmXxgrxjAvQDI/axOKdkqTFah0Nsyt7DLYhDSKvwLn+95+WpLs9k8ISAMTXfMp/8qyGQAemIXjBQXMgx0=
X-Received: by 2002:ac8:59c3:0:b0:2e1:a305:cc6 with SMTP id
f3-20020ac859c3000000b002e1a3050cc6mr22146643qtf.429.1647346299284; Tue, 15
Mar 2022 05:11:39 -0700 (PDT)
In-Reply-To: <2e3v2h1qblv12ipkqtj55rkv2v2oobgu5v@4ax.com>
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAKXe9UCWMSdN67OKUXFRW+nBhQhfqUH=NeqSRed53S089znhSQ@mail.gmail.com>
X-Mailman-Original-References: <CAKXe9UALi+jOEFfv9cS6QvRRvy8ssEoVDEx+y5u8OpHCNEMp9A@mail.gmail.com>
<BN8PR14MB28512DF8C49A3E16DA815D11F50F9@BN8PR14MB2851.namprd14.prod.outlook.com>
<CAKXe9UCyCH3PyAxK4-5knt7rrims8_zcjGzxh7JGHNj-ef=Vaw@mail.gmail.com>
<mailman.299.1647281866.2329.python-list@python.org>
<2e3v2h1qblv12ipkqtj55rkv2v2oobgu5v@4ax.com>
 by: Les - Tue, 15 Mar 2022 12:11 UTC

Dennis Lee Bieber <wlfraed@ix.netcom.com> ezt írta (időpont: 2022.. márc.
14., H 20:03):

> On Mon, 14 Mar 2022 19:17:31 +0100, Les <nagylzs@gmail.com> declaimed the
> following:
>
> >Unfortunately, the reportlab-users mailing list is unavailable (I cannot
> >subscribe). There is paid support but since I already have a workaround, I
> >won't pay for this. I think this is a documentation error of the reportlab
> >package. (They do not mention that stories cannot be reused.)
> >
>
>
> https://github.com/eduardocereto/reportlab/blob/master/src/reportlab/platypus/doctemplate.py
> """
> A document is built when a DocumentTemplate is fed a sequence of Flowables.
> The action of the build consumes the flowables in order and places them
> onto frames on pages as space allows. When a frame runs out of space the
> next frame of the page is used. If no frame remains a new page is created.
> A new page can also be created if a page break is forced.
> """
>
> Well, the code does use the term "consumes"
>
> And down near the bottom (line 980 or so; this is a section that
> does
> multiple passes for special cases)
> """
> # work with a copy of the story, since it is consumed
> tempStory = story[:]
> self.build(tempStory, **buildKwds)
> #self.notify('debug',None)
> """
>

Well, the official user guide (
https://www.reportlab.com/docs/reportlab-userguide.pdf ) only uses the word
"consume" in section "5.5 Frames", but it does not imply that a story
cannot be reused for generating multiple documents. It could also mean that
each document builder consumes each Flowable only once. So I still think
that this behaviour is undocumented.

It is very interesting that they use story[:] to make a swallow copy for
multiple passes. It must work in that particular case (e.g. when you build
the same document multiple times), but it surely does not work when you
build different documents using the same story (throws a LayoutError).

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor