summaryrefslogtreecommitdiff
path: root/docutils
diff options
context:
space:
mode:
authormilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2011-06-07 15:05:58 +0000
committermilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2011-06-07 15:05:58 +0000
commit326094fb00c8b4b3a92e09c02f1996070aa80004 (patch)
tree4c7d19a454a2f4551373534641ba353500f55437 /docutils
parentf65bf2c562453fc04bce7c0b0435604d477c9469 (diff)
downloaddocutils-326094fb00c8b4b3a92e09c02f1996070aa80004.tar.gz
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: http://svn.code.sf.net/p/docutils/code/trunk/docutils@7054 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils')
-rw-r--r--docutils/nodes.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/docutils/nodes.py b/docutils/nodes.py
index afb541fb9..9a868cd1b 100644
--- a/docutils/nodes.py
+++ b/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))