Project

General

Profile

« Previous | Next » 

Revision 331

xml_dom.py: Node.__str__() uses toprettyxml() instead of toxml()

View differences:

lib/xml_dom.py
6 6
import xml.dom.minidom as minidom
7 7

  
8 8
import strings
9
import util
9 10

  
10 11
def escape(str_):
11 12
    return strings.to_unicode(cgi.escape(str_, True)).encode('ascii',
......
141 142
    return minidom.getDOMImplementation().createDocument(None, root, None)
142 143

  
143 144
prettyxml_config = dict(addindent='    ', newl='\n')
145
toprettyxml_config = prettyxml_config.copy()
146
util.rename_key(toprettyxml_config, 'addindent', 'indent')
144 147

  
145 148
# minidom modifications
146 149

  
......
148 151

  
149 152
minidom.Node.__iter__ = lambda self: NodeIter(self)
150 153

  
151
minidom.Node.__str__ = lambda self: self.toxml()
154
minidom.Node.__str__ = lambda self: self.toprettyxml(**toprettyxml_config)
152 155

  
153 156
minidom.Node.pop = lambda self: self.removeChild(self.lastChild)
154 157

  

Also available in: Unified diff