[Bug 2084118] [NEW] [PATCH] Trivial bugs in linear gradients in tables

RĂ¼diger Kuhlmann 2084118 at bugs.launchpad.net
Thu Oct 10 06:45:25 UTC 2024


Public bug reported:

Specifying a tuple/list (with two entries) for the extend parameter in a
linear or radial gradient in a Table will fail, as the parameter is used
with a list compaction as format parameter. Thus it is a list. But the
format needs a tuple, so it fails with a python error. Example usage:

Table([[...]], style=[ ('BACKGROUND', (1, 1), (1, 1), ('RADIALGRADIENT', (1, 1), (1, 'width'),
 (True, False), # <--- this parameter
('#DEDEDE', '#DEDEDE', '#FDFDFD', '#FFFFFF'), (0, 0.1, 0.9, 1))),

The same code path is taken for Canvas.linearGradient() and
Canvas.radialGradient().

Additionally, specifying positions for the gradient (the last parameter
in the example) will not work for both linear and radial gradients, as
the parameter is ignored if it is given and accessed if it is not given
(one off error).

All can be fixed with a trivial patch - please have a look, this can be
verified to be correct even without reportlab knowledge.

These errors also exist in the most recent upstream version. Please feel
free to also forward the patch.

** Affects: python-reportlab (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: patch

** Patch added: "patch"
   https://bugs.launchpad.net/bugs/2084118/+attachment/5826688/+files/reportlab.patch

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python-reportlab in Ubuntu.
https://bugs.launchpad.net/bugs/2084118

Title:
  [PATCH] Trivial bugs in linear gradients in tables

Status in python-reportlab package in Ubuntu:
  New

Bug description:
  Specifying a tuple/list (with two entries) for the extend parameter in
  a linear or radial gradient in a Table will fail, as the parameter is
  used with a list compaction as format parameter. Thus it is a list.
  But the format needs a tuple, so it fails with a python error. Example
  usage:

  Table([[...]], style=[ ('BACKGROUND', (1, 1), (1, 1), ('RADIALGRADIENT', (1, 1), (1, 'width'),
   (True, False), # <--- this parameter
  ('#DEDEDE', '#DEDEDE', '#FDFDFD', '#FFFFFF'), (0, 0.1, 0.9, 1))),

  The same code path is taken for Canvas.linearGradient() and
  Canvas.radialGradient().

  Additionally, specifying positions for the gradient (the last
  parameter in the example) will not work for both linear and radial
  gradients, as the parameter is ignored if it is given and accessed if
  it is not given (one off error).

  All can be fixed with a trivial patch - please have a look, this can
  be verified to be correct even without reportlab knowledge.

  These errors also exist in the most recent upstream version. Please
  feel free to also forward the patch.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-reportlab/+bug/2084118/+subscriptions




More information about the foundations-bugs mailing list