Table gradient bugfix
Justin Brzozoski <[email protected]> Thu, 13 Jan 2022 00:44:57 -0500
| Newsgroups | gmane.comp.python.reportlab.user |
|---|---|
| Message-ID | <CAHOd3zsHXkqqs-ce3Em6eG+AgR-vVZ5B9FWetx+NZUrgDLuxpA@mail.gmail.com> |
Bumped into a bug when using gradient backgrounds on a table, if the display portion with the gradient repeats (i.e. on the first row of multiple pages) then it was failing. The first use was mutating the arguments list, and subsequent uses were missing arguments. A patch to fix it is attached. Thanks, Justin Brzozoski
fix4694.diff
(text/x-patch, 1.2 KB)
# HG changeset patch # User Justin Brzozoski <[email protected]> # Date 1642052329 18000 # Thu Jan 13 00:38:49 2022 -0500 # Node ID 7a1aec7dfcd975295b91916582888fd3ed7cce6c # Parent ace945128507d4069a9eda39bedbd6b96c6afba0 Fix bug when reusing table background parameter more than once diff -r ace945128507 -r 7a1aec7dfcd9 src/reportlab/platypus/tables.py --- a/src/reportlab/platypus/tables.py Fri Dec 24 12:26:07 2021 +0000 +++ b/src/reportlab/platypus/tables.py Thu Jan 13 00:38:49 2022 -0500 @@ -1748,11 +1748,11 @@ p = canv.beginPath() p.rect(x0, y0, w, h) canv.clipPath(p, stroke=0) - direction=arg.pop(0) + direction=arg[0] if direction=="HORIZONTAL": - canv.linearGradient(x0,y0,x0+w,y0,arg,extend=False) + canv.linearGradient(x0,y0,x0+w,y0,arg[1:],extend=False) else: #VERTICAL - canv.linearGradient(x0,y0,x0,y0+h,arg,extend=False) + canv.linearGradient(x0,y0,x0,y0+h,arg[1:],extend=False) canv.restoreState() else: color = colors.toColorOrNone(arg)