Package: python-gdchart2
Version: 0.beta1-3
Severity: normal
Tags: patch

When processing a lookup value (eg. percent_labels) in getOption() it only
processes the first option as the 'else:' clause is paired with the wrong
block. It is paired with an 'if' instead of the 'for' loop.

Reproducable with the code below. Note the loop is over a dict.items() so
it is unordered. If the "RIGHT" option does't cause the error try another;
"ABOVE", "BELOW", "LEFT", or "NONE".

------------------------------------------
myPie = gdchart.Pie3D()
myPie.title = "Pie3D"
myPie.color = ["red", "green", "yellow", "orange", "blue", "red", "green"]
myPie.width = 250
myPie.height = 250
myPie.setData(1, 2, 3, 4, 5)
myPie.setLabels(["One", "Two", "Three", "Four", "Five"])
myPie.percent_labels = "RIGHT" #<-- this one causes the problem
myPie.draw("imgpie.png")
------------------------------------------

A patch to fix the issue is attached.


-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.6.15-ck3
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages python-gdchart2 depends on:
ii  python                        2.3.5-5    An interactive high-level object-o
ii  python2.3-gdchart2            0.beta1-3  Python OO interface to GDChart

python-gdchart2 recommends no packages.

-- no debconf information
--- gdchart-orig.py     2006-03-22 14:28:55.000000000 -0500
+++ gdchart.py  2006-03-22 14:26:29.000000000 -0500
@@ -261,8 +261,8 @@
                 for k, v in self._lookupOptions[option].items():
                     if v == val:
                         return k
-                    else:
-                        raise GDChartError, "Lookup value not known - this 
should never happen. Please contact software authors."
+                else:
+                    raise GDChartError, "Lookup value not known - this should 
never happen. Please contact software authors."
             elif self._maskOptions.has_key(option):
                 lst = []
                 for k, v in self._maskOptions[option].items():

Reply via email to