[Python-checkins] CVS: python/dist/src/Lib ConfigParser.py,1.27,1.28

Eric S. Raymond esr@users.sourceforge.net
Thu, 08 Feb 2001 21:19:11 -0800


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

Modified Files:
	ConfigParser.py 
Log Message:
String method conversion.


Index: ConfigParser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/ConfigParser.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -r1.27 -r1.28
*** ConfigParser.py	2001/01/20 19:54:20	1.27
--- ConfigParser.py	2001/02/09 05:19:09	1.28
***************
*** 294,298 ****
          while depth < 10:               # Loop through this until it's done
              depth = depth + 1
!             if string.find(value, "%(") >= 0:
                  try:
                      value = value % d
--- 294,298 ----
          while depth < 10:               # Loop through this until it's done
              depth = depth + 1
!             if value.find("%(") >= 0:
                  try:
                      value = value % d
***************
*** 316,320 ****
      def getboolean(self, section, option):
          v = self.get(section, option)
!         val = string.atoi(v)
          if val not in (0, 1):
              raise ValueError, 'Not a boolean: %s' % v
--- 316,320 ----
      def getboolean(self, section, option):
          v = self.get(section, option)
!         val = v.atoi()
          if val not in (0, 1):
              raise ValueError, 'Not a boolean: %s' % v
***************
*** 322,326 ****
  
      def optionxform(self, optionstr):
!         return string.lower(optionstr)
  
      def has_option(self, section, option):
--- 322,326 ----
  
      def optionxform(self, optionstr):
!         return optionstr.lower()
  
      def has_option(self, section, option):
***************
*** 420,431 ****
              lineno = lineno + 1
              # comment or blank line?
!             if string.strip(line) == '' or line[0] in '#;':
                  continue
!             if string.lower(string.split(line)[0]) == 'rem' \
                 and line[0] in "rR":      # no leading whitespace
                  continue
              # continuation line?
              if line[0] in ' \t' and cursect is not None and optname:
!                 value = string.strip(line)
                  if value:
                      cursect[optname] = cursect[optname] + '\n ' + value
--- 420,431 ----
              lineno = lineno + 1
              # comment or blank line?
!             if line.strip() == '' or line[0] in '#;':
                  continue
!             if line.split()[0].lower() == 'rem' \
                 and line[0] in "rR":      # no leading whitespace
                  continue
              # continuation line?
              if line[0] in ' \t' and cursect is not None and optname:
!                 value = line.strip()
                  if value:
                      cursect[optname] = cursect[optname] + '\n ' + value
***************
*** 456,463 ****
                              # ';' is a comment delimiter only if it follows
                              # a spacing character
!                             pos = string.find(optval, ';')
                              if pos and optval[pos-1] in string.whitespace:
                                  optval = optval[:pos]
!                         optval = string.strip(optval)
                          # allow empty values
                          if optval == '""':
--- 456,463 ----
                              # ';' is a comment delimiter only if it follows
                              # a spacing character
!                             pos = optval.find(';')
                              if pos and optval[pos-1] in string.whitespace:
                                  optval = optval[:pos]
!                         optval = optval.strip()
                          # allow empty values
                          if optval == '""':