From ba2f32d00b937312c6cc8b11c6f3f73d66a0e24c Mon Sep 17 00:00:00 2001 From: Florian Mounier Date: Fri, 6 Nov 2015 10:39:24 +0100 Subject: [PATCH] Fix transposable_node in case all attributes are not there. --- docs/changelog.rst | 8 +++++++- pygal/__init__.py | 2 +- pygal/svg.py | 9 ++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 95103a8..fdd0e70 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -2,11 +2,17 @@ Changelog ========= +2.0.10 +====== + +* Fix transposable_node in case all attributes are not there. (thanks @yobuntu). + + 2.0.9 ===== * Add `dynamic_print_values` to show print_values on legend hover. (#279) -* Fix unparse_color for python 3.5+ compatibility (thanks felixonmars, sjourdois) +* Fix unparse_color for python 3.5+ compatibility (thanks @felixonmars, @sjourdois) * Process major labels as labels. (#263) * Fix labels rotation > 180 (#257) * Fix secondary axis diff --git a/pygal/__init__.py b/pygal/__init__.py index bc3dfb3..777807f 100644 --- a/pygal/__init__.py +++ b/pygal/__init__.py @@ -24,7 +24,7 @@ and the maps extensions namespace module. """ -__version__ = '2.0.9' +__version__ = '2.0.10' import pkg_resources import sys diff --git a/pygal/svg.py b/pygal/svg.py index 9093b44..1d1108e 100644 --- a/pygal/svg.py +++ b/pygal/svg.py @@ -205,7 +205,14 @@ class Svg(object): for key1, key2 in (('x', 'y'), ('width', 'height'), ('cx', 'cy')): attr1 = extras.get(key1, None) attr2 = extras.get(key2, None) - extras[key1], extras[key2] = attr2, attr1 + if attr2: + extras[key1] = attr2 + elif attr1: + del extras[key1] + if attr1: + extras[key2] = attr1 + elif attr2: + del extras[key2] return self.node(parent, tag, attrib, **extras) def serie(self, serie):