Remove dict.has_key() usage in xml.dom.minidom to silence warnings while

running under -3.
This commit is contained in:
Brett Cannon 2008-08-04 00:23:58 +00:00
parent a36f8fefb0
commit 5dd504df28
1 changed files with 4 additions and 4 deletions

View File

@ -245,7 +245,7 @@ class Node(xml.dom.Node):
except AttributeError: except AttributeError:
d = {} d = {}
self._user_data = d self._user_data = d
if d.has_key(key): if key in d:
old = d[key][0] old = d[key][0]
if data is None: if data is None:
# ignore handlers passed for None # ignore handlers passed for None
@ -562,7 +562,7 @@ class NamedNodeMap(object):
_clear_id_cache(self._ownerElement) _clear_id_cache(self._ownerElement)
del self._attrs[n.nodeName] del self._attrs[n.nodeName]
del self._attrsNS[(n.namespaceURI, n.localName)] del self._attrsNS[(n.namespaceURI, n.localName)]
if n.__dict__.has_key('ownerElement'): if 'ownerElement' in n.__dict__:
n.__dict__['ownerElement'] = None n.__dict__['ownerElement'] = None
return n return n
else: else:
@ -574,7 +574,7 @@ class NamedNodeMap(object):
_clear_id_cache(self._ownerElement) _clear_id_cache(self._ownerElement)
del self._attrsNS[(n.namespaceURI, n.localName)] del self._attrsNS[(n.namespaceURI, n.localName)]
del self._attrs[n.nodeName] del self._attrs[n.nodeName]
if n.__dict__.has_key('ownerElement'): if 'ownerElement' in n.__dict__:
n.__dict__['ownerElement'] = None n.__dict__['ownerElement'] = None
return n return n
else: else:
@ -1664,7 +1664,7 @@ class Document(Node, DocumentLS):
return n return n
def getElementById(self, id): def getElementById(self, id):
if self._id_cache.has_key(id): if id in self._id_cache:
return self._id_cache[id] return self._id_cache[id]
if not (self._elem_info or self._magic_id_count): if not (self._elem_info or self._magic_id_count):
return None return None