[Python-checkins] CVS: python/dist/src/Lib/xml/dom minidom.py,1.42,1.43

Fred L. Drake fdrake@users.sourceforge.net
Thu, 06 Dec 2001 10:27:50 -0800


Update of /cvsroot/python/python/dist/src/Lib/xml/dom
In directory usw-pr-cvs1:/tmp/cvs-serv12898/xml/dom

Modified Files:
	minidom.py 
Log Message:
Attribute nodes did not always get their ownerDocument and ownerElement
properly set.  This fixes that.


Index: minidom.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/xml/dom/minidom.py,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** minidom.py	2001/12/06 04:32:18	1.42
--- minidom.py	2001/12/06 18:27:48	1.43
***************
*** 365,371 ****
      """
  
!     def __init__(self, attrs, attrsNS):
          self._attrs = attrs
          self._attrsNS = attrsNS
  
      try:
--- 365,372 ----
      """
  
!     def __init__(self, attrs, attrsNS, ownerElement):
          self._attrs = attrs
          self._attrsNS = attrsNS
+         self._ownerElement = ownerElement
  
      try:
***************
*** 431,434 ****
--- 432,436 ----
              node = Attr(attname)
              node.value = value
+             node.ownerDocument = self._ownerElement.ownerDocument
          else:
              if not isinstance(value, Attr):
***************
*** 446,449 ****
--- 448,452 ----
          self._attrs[node.name] = node
          self._attrsNS[(node.namespaceURI, node.localName)] = node
+         node.ownerElement = self._ownerElement
          return old
  
***************
*** 519,523 ****
          attr = Attr(attname)
          # for performance
!         attr.__dict__["value"] = attr.__dict__["nodeValue"] = value
          self.setAttributeNode(attr)
  
--- 522,528 ----
          attr = Attr(attname)
          # for performance
!         d = attr.__dict__
!         d["value"] = d["nodeValue"] = value
!         d["ownerDocument"] = self.ownerDocument
          self.setAttributeNode(attr)
  
***************
*** 526,530 ****
          # for performance
          attr = Attr(qualifiedName, namespaceURI, localname, prefix)
!         attr.__dict__["value"] = attr.__dict__["nodeValue"] = value
          self.setAttributeNode(attr)
  
--- 531,537 ----
          # for performance
          attr = Attr(qualifiedName, namespaceURI, localname, prefix)
!         d = attr.__dict__
!         d["value"] = d["nodeValue"] = value
!         d["ownerDocument"] = self.ownerDocument
          self.setAttributeNode(attr)
  
***************
*** 609,613 ****
  
      def _get_attributes(self):
!         return AttributeList(self._attrs, self._attrsNS)
  
      try:
--- 616,620 ----
  
      def _get_attributes(self):
!         return NamedNodeMap(self._attrs, self._attrsNS, self)
  
      try: