Commit 861fd6fd authored by Brett Cannon's avatar Brett Cannon

Fix xml.dom.minidom so it works again after the dict views introduction.

There are some methods in minidom that return dict.keys() directly.  There were
left alone since the tests passed without touching them, but it might be
prudent to just wrap them in a 'list' call to be safe for people expecting a
list.
parent ecca313a
test_bsddb test_bsddb3 test_compile test_dumbdbm test_bsddb test_bsddb3 test_compile test_dumbdbm
test_importhooks test_iter test_iterlen test_minidom test_importhooks test_iter test_iterlen
...@@ -565,10 +565,8 @@ def _setupCloneElement(deep): ...@@ -565,10 +565,8 @@ def _setupCloneElement(deep):
def _testCloneElementCopiesAttributes(e1, e2, test): def _testCloneElementCopiesAttributes(e1, e2, test):
attrs1 = e1.attributes attrs1 = e1.attributes
attrs2 = e2.attributes attrs2 = e2.attributes
keys1 = attrs1.keys() keys1 = sorted(attrs1.keys())
keys2 = attrs2.keys() keys2 = sorted(attrs2.keys())
keys1.sort()
keys2.sort()
confirm(keys1 == keys2, "clone of element has same attribute keys") confirm(keys1 == keys2, "clone of element has same attribute keys")
for i in range(len(keys1)): for i in range(len(keys1)):
a1 = attrs1.item(i) a1 = attrs1.item(i)
...@@ -1351,8 +1349,7 @@ def testPickledDocument(): ...@@ -1351,8 +1349,7 @@ def testPickledDocument():
# --- MAIN PROGRAM # --- MAIN PROGRAM
names = globals().keys() names = sorted(globals().keys())
names.sort()
failed = [] failed = []
......
...@@ -256,7 +256,7 @@ class Node(xml.dom.Node): ...@@ -256,7 +256,7 @@ class Node(xml.dom.Node):
def _call_user_data_handler(self, operation, src, dst): def _call_user_data_handler(self, operation, src, dst):
if hasattr(self, "_user_data"): if hasattr(self, "_user_data"):
for key, (data, handler) in self._user_data.items(): for key, (data, handler) in list(self._user_data.items()):
if handler is not None: if handler is not None:
handler.handle(operation, key, data, src, dst) handler.handle(operation, key, data, src, dst)
...@@ -480,7 +480,7 @@ class NamedNodeMap(object): ...@@ -480,7 +480,7 @@ class NamedNodeMap(object):
def item(self, index): def item(self, index):
try: try:
return self[self._attrs.keys()[index]] return self[list(self._attrs.keys())[index]]
except IndexError: except IndexError:
return None return None
...@@ -672,7 +672,7 @@ class Element(Node): ...@@ -672,7 +672,7 @@ class Element(Node):
return self.tagName return self.tagName
def unlink(self): def unlink(self):
for attr in self._attrs.values(): for attr in list(self._attrs.values()):
attr.unlink() attr.unlink()
self._attrs = None self._attrs = None
self._attrsNS = None self._attrsNS = None
...@@ -805,8 +805,7 @@ class Element(Node): ...@@ -805,8 +805,7 @@ class Element(Node):
writer.write(indent+"<" + self.tagName) writer.write(indent+"<" + self.tagName)
attrs = self._get_attributes() attrs = self._get_attributes()
a_names = attrs.keys() a_names = sorted(attrs.keys())
a_names.sort()
for a_name in a_names: for a_name in a_names:
writer.write(" %s=\"" % a_name) writer.write(" %s=\"" % a_name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment