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

Fred L. Drake fdrake@users.sourceforge.net
Wed, 04 Apr 2001 08:15:21 -0700


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

Modified Files:
	minidom.py 
Log Message:

CharacterData methods:  Update self.length on changes instead of extended
    the __getattr__() handler.

Text.splitText():  Update the length and nodeValue attributes.


Index: minidom.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/xml/dom/minidom.py,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -r1.30 -r1.31
*** minidom.py	2001/04/04 14:09:46	1.30
--- minidom.py	2001/04/04 15:15:18	1.31
***************
*** 620,628 ****
          Node.__init__(self)
          self.data = self.nodeValue = data
  
-     def __getattr__(self, name):
-         if name == "length":
-             return len(self.data)
- 
      def __repr__(self):
          if len(self.data) > 10:
--- 620,625 ----
          Node.__init__(self)
          self.data = self.nodeValue = data
+         self.length = len(data)
  
      def __repr__(self):
          if len(self.data) > 10:
***************
*** 645,648 ****
--- 642,646 ----
          self.data = self.data + arg
          self.nodeValue = self.data
+         self.length = len(self.data)
  
      def insertData(self, offset, arg):
***************
*** 655,658 ****
--- 653,657 ----
                  self.data[:offset], arg, self.data[offset:])
              self.nodeValue = self.data
+             self.length = len(self.data)
  
      def deleteData(self, offset, count):
***************
*** 666,669 ****
--- 665,669 ----
              self.data = self.data[:offset] + self.data[offset+count:]
              self.nodeValue = self.data
+             self.length = len(self.data)
  
      def replaceData(self, offset, count, arg):
***************
*** 678,681 ****
--- 678,682 ----
                  self.data[:offset], arg, self.data[offset+count:])
              self.nodeValue = self.data
+             self.length = len(self.data)
  
  class Text(CharacterData):
***************
*** 696,699 ****
--- 697,702 ----
                  self.parentNode.insertBefore(newText, next)
          self.data = self.data[:offset]
+         self.nodeValue = self.data
+         self.length = len(self.data)
          return newText