[Python-checkins] CVS: python/dist/src/Lib mailcap.py,1.8,1.9
Eric S. Raymond
esr@users.sourceforge.net
Fri, 09 Feb 2001 02:23:57 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv6373
Modified Files:
mailcap.py
Log Message:
String method conversion.
Index: mailcap.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/mailcap.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** mailcap.py 2001/01/24 06:27:27 1.8
--- mailcap.py 2001/02/09 10:23:55 1.9
***************
*** 2,6 ****
import os
- import string
__all__ = ["getcaps","findmatch"]
--- 2,5 ----
***************
*** 38,42 ****
if os.environ.has_key('MAILCAPS'):
str = os.environ['MAILCAPS']
! mailcaps = string.splitfields(str, ':')
else:
if os.environ.has_key('HOME'):
--- 37,41 ----
if os.environ.has_key('MAILCAPS'):
str = os.environ['MAILCAPS']
! mailcaps = str.split(':')
else:
if os.environ.has_key('HOME'):
***************
*** 66,70 ****
if not line: break
# Ignore comments and blank lines
! if line[0] == '#' or string.strip(line) == '':
continue
nextline = line
--- 65,69 ----
if not line: break
# Ignore comments and blank lines
! if line[0] == '#' or line.strip() == '':
continue
nextline = line
***************
*** 79,86 ****
continue
# Normalize the key
! types = string.splitfields(key, '/')
for j in range(len(types)):
! types[j] = string.strip(types[j])
! key = string.lower(string.joinfields(types, '/'))
# Update the database
if caps.has_key(key):
--- 78,85 ----
continue
# Normalize the key
! types = key.split('/')
for j in range(len(types)):
! types[j] = types[j].strip()
! key = '/'.join(types).lower()
# Update the database
if caps.has_key(key):
***************
*** 107,117 ****
fields = {'view': view}
for field in rest:
! i = string.find(field, '=')
if i < 0:
fkey = field
fvalue = ""
else:
! fkey = string.strip(field[:i])
! fvalue = string.strip(field[i+1:])
if fields.has_key(fkey):
# Ignore it
--- 106,116 ----
fields = {'view': view}
for field in rest:
! i = field.find('=')
if i < 0:
fkey = field
fvalue = ""
else:
! fkey = field[:i].strip()
! fvalue = field[i+1:].strip()
if fields.has_key(fkey):
# Ignore it
***************
*** 132,136 ****
else:
i = i+1
! return string.strip(line[start:i]), i
--- 131,135 ----
else:
i = i+1
! return line[start:i].strip(), i
***************
*** 161,165 ****
if caps.has_key(MIMEtype):
entries = entries + caps[MIMEtype]
! MIMEtypes = string.splitfields(MIMEtype, '/')
MIMEtype = MIMEtypes[0] + '/*'
if caps.has_key(MIMEtype):
--- 160,164 ----
if caps.has_key(MIMEtype):
entries = entries + caps[MIMEtype]
! MIMEtypes = MIMEtype.split('/')
MIMEtype = MIMEtypes[0] + '/*'
if caps.has_key(MIMEtype):
***************
*** 202,209 ****
def findparam(name, plist):
! name = string.lower(name) + '='
n = len(name)
for p in plist:
! if string.lower(p[:n]) == name:
return p[n:]
return ''
--- 201,208 ----
def findparam(name, plist):
! name = name.lower() + '='
n = len(name)
for p in plist:
! if p[:n].lower() == name:
return p[n:]
return ''