changeset 176:ccf67a4de4fa

Make sure that numbers in text nodes are converted to strings.
author cmlenz
date Wed, 31 Aug 2005 00:37:07 +0000
parents f7c2f112afe6
children a661612d17e2
files bitten/util/xmlio.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/bitten/util/xmlio.py
+++ b/bitten/util/xmlio.py
@@ -63,7 +63,7 @@
         elif isinstance(node, Fragment):
             self.children += node.children
         elif node is not None and node != '':
-            self.children.append(node)
+            self.children.append(str(node))
 
     def write(self, out, newlines=False):
         """Serializes the element and writes the XML to the given output
@@ -111,6 +111,8 @@
 
     >>> print Element('foo')['Hello world']
     <foo>Hello world</foo>
+    >>> print Element('foo')[42]
+    <foo>42</foo>
     >>> print Element('foo')['1 < 2']
     <foo>1 &lt; 2</foo>
 
Copyright (C) 2012-2017 Edgewall Software