[XML-SIG] Adding update and has_key methods to xml.dom.minidom.NamedNodeMap

Joonas Paalasmaa joonas@olen.to
Sun, 24 Mar 2002 17:54:45 +0200


Is there some particular reason why xml.dom.minidom.NamedNodeMap lacks
many methods that builtin-type dics has. For example "update"-method
would be quite useful for xml manipulation purposes. Here's a patch that
adds update and has_key methods to xml.dom.minidom.NamedNodeMap. What do
you people think? Should it be committed?

diff -c -r1.45 minidom.py
*** minidom.py  15 Mar 2002 14:37:23 -0000      1.45
--- minidom.py  24 Mar 2002 15:58:01 -0000
***************
*** 410,415 ****
--- 410,425 ----
      def get(self, name, value = None):
          return self._attrs.get(name, value)

+     def update(self, updatedict):
+         for k, v in updatedict.items():
+             self[k] = v
+
+     def has_key(self, key):
+         return self._attrs.has_key(key)
+
+     def has_keyNS(self, key):
+         return self._attrsNS.has_key(key)
+
      def __len__(self):
          return self.length