From 3b1f4db1053770370403d6e79dd1567f9c62624a Mon Sep 17 00:00:00 2001 From: milde Date: Tue, 7 Jun 2011 15:05:58 +0000 Subject: [PATCH] Apply tuple_args_guard.patch [ 2993967 ] When there are any attributes which have tuple attribute values DOM rendering fails because string interpolation receives a wrong number of arguments. It needs to be safeguarded against this case by carefully packing the values into a tuple beforehand. This problem might crop up in other places as well. git-svn-id: https://docutils.svn.sourceforge.net/svnroot/docutils/trunk@7054 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- docutils/docutils/nodes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docutils/docutils/nodes.py b/docutils/docutils/nodes.py index afb541fb9..9a868cd1b 100644 --- a/docutils/docutils/nodes.py +++ b/docutils/docutils/nodes.py @@ -461,7 +461,7 @@ class Element(Node): element = domroot.createElement(self.tagname) for attribute, value in self.attlist(): if isinstance(value, list): - value = ' '.join([serial_escape('%s' % v) for v in value]) + value = ' '.join([serial_escape('%s' % (v,)) for v in value]) element.setAttribute(attribute, '%s' % value) for child in self.children: element.appendChild(child._dom_node(domroot)) @@ -505,7 +505,7 @@ class Element(Node): if value is None: # boolean attribute parts.append(name) elif isinstance(value, list): - values = [serial_escape('%s' % v) for v in value] + values = [serial_escape('%s' % (v,)) for v in value] parts.append('%s="%s"' % (name, ' '.join(values))) else: parts.append('%s="%s"' % (name, value)) -- 2.11.4.GIT