[Python-checkins] CVS: python/dist/src/Lib mimify.py,1.17,1.18

Eric S. Raymond esr@users.sourceforge.net
Thu, 08 Feb 2001 23:08:22 -0800


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

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


Index: mimify.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/mimify.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** mimify.py	2001/01/25 15:29:22	1.17
--- mimify.py	2001/02/09 07:08:20	1.18
***************
*** 28,32 ****
  # End configure
  
! import re, string
  
  __all__ = ["mimify","unmimify","mime_encode_header","mime_decode_header"]
--- 28,32 ----
  # End configure
  
! import re
  
  __all__ = ["mimify","unmimify","mime_encode_header","mime_decode_header"]
***************
*** 97,101 ****
              break
          newline = newline + line[pos:res.start(0)] + \
!                   chr(string.atoi(res.group(1), 16))
          pos = res.end(0)
      return newline + line[pos:]
--- 97,101 ----
              break
          newline = newline + line[pos:res.start(0)] + \
!                   chr(int(res.group(1), 16))
          pos = res.end(0)
      return newline + line[pos:]
***************
*** 111,115 ****
          match = res.group(1)
          # convert underscores to spaces (before =XX conversion!)
!         match = string.join(string.split(match, '_'), ' ')
          newline = newline + line[pos:res.start(0)] + mime_decode(match)
          pos = res.end(0)
--- 111,115 ----
          match = res.group(1)
          # convert underscores to spaces (before =XX conversion!)
!         match = ' '.join(string.split(match, '_'))
          newline = newline + line[pos:res.start(0)] + mime_decode(match)
          pos = res.end(0)
***************
*** 233,237 ****
      if len(line) >= 5 and line[:5] == 'From ':
          # quote 'From ' at the start of a line for stupid mailers
!         newline = string.upper('=%02x' % ord('F'))
          pos = 1
      while 1:
--- 233,237 ----
      if len(line) >= 5 and line[:5] == 'From ':
          # quote 'From ' at the start of a line for stupid mailers
!         newline = ('=%02x' % ord('F')).upper()
          pos = 1
      while 1:
***************
*** 240,244 ****
              break
          newline = newline + line[pos:res.start(0)] + \
!                   string.upper('=%02x' % ord(res.group(0)))
          pos = res.end(0)
      line = newline + line[pos:]
--- 240,244 ----
              break
          newline = newline + line[pos:res.start(0)] + \
!                   ('=%02x' % ord(res.group(0))).upper()
          pos = res.end(0)
      line = newline + line[pos:]
***************
*** 347,351 ****
              if has_iso_chars:
                  # change us-ascii into iso-8859-1
!                 if string.lower(chrset_res.group(2)) == 'us-ascii':
                      line = '%s%s%s' % (chrset_res.group(1),
                                         CHARSET,
--- 347,351 ----
              if has_iso_chars:
                  # change us-ascii into iso-8859-1
!                 if chrset_res.group(2).lower() == 'us-ascii':
                      line = '%s%s%s' % (chrset_res.group(1),
                                         CHARSET,
***************
*** 448,452 ****
          elif o == '-l':
              try:
!                 MAXLEN = string.atoi(a)
              except:
                  print usage
--- 448,452 ----
          elif o == '-l':
              try:
!                 MAXLEN = int(a)
              except:
                  print usage