summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-12-15 15:49:08 (GMT)
committerGuido van Rossum <guido@python.org>2000-12-15 15:49:08 (GMT)
commite6e03eafed6cf88e350075e89da662b76dfe0fa8 (patch)
tree2a4b7eb0ca7c5c41c4b961630b4db3c42fc4e5d7 /Lib
parentc80f182dc46ae2d8027c13cb01d0045e9a2650dc (diff)
downloadcpython-e6e03eafed6cf88e350075e89da662b76dfe0fa8.zip
cpython-e6e03eafed6cf88e350075e89da662b76dfe0fa8.tar.gz
cpython-e6e03eafed6cf88e350075e89da662b76dfe0fa8.tar.bz2
Get rid of string functions.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/mimetools.py29
1 files changed, 14 insertions, 15 deletions
diff --git a/Lib/mimetools.py b/Lib/mimetools.py
index abdfa62..630a1c3 100644
--- a/Lib/mimetools.py
+++ b/Lib/mimetools.py
@@ -3,7 +3,6 @@
import os
import rfc822
-import string
import tempfile
@@ -25,17 +24,17 @@ class Message(rfc822.Message):
if str is None:
str = 'text/plain'
if ';' in str:
- i = string.index(str, ';')
+ i = str.index(';')
self.plisttext = str[i:]
str = str[:i]
else:
self.plisttext = ''
- fields = string.splitfields(str, '/')
+ fields = str.split('/')
for i in range(len(fields)):
- fields[i] = string.lower(string.strip(fields[i]))
- self.type = string.joinfields(fields, '/')
+ fields[i] = fields[i].strip().lower()
+ self.type = '/'.join(fields)
self.maintype = fields[0]
- self.subtype = string.joinfields(fields[1:], '/')
+ self.subtype = '/'.join(fields[1:])
def parseplist(self):
str = self.plisttext
@@ -44,22 +43,22 @@ class Message(rfc822.Message):
str = str[1:]
if ';' in str:
# XXX Should parse quotes!
- end = string.index(str, ';')
+ end = str.index(';')
else:
end = len(str)
f = str[:end]
if '=' in f:
- i = string.index(f, '=')
- f = string.lower(string.strip(f[:i])) + \
- '=' + string.strip(f[i+1:])
- self.plist.append(string.strip(f))
+ i = f.index('=')
+ f = f[:i].strip().lower() + \
+ '=' + f[i+1:].strip()
+ self.plist.append(f.strip())
str = str[end:]
def getplist(self):
return self.plist
def getparam(self, name):
- name = string.lower(name) + '='
+ name = name.lower() + '='
n = len(name)
for p in self.plist:
if p[:n] == name:
@@ -69,15 +68,15 @@ class Message(rfc822.Message):
def getparamnames(self):
result = []
for p in self.plist:
- i = string.find(p, '=')
+ i = p.find('=')
if i >= 0:
- result.append(string.lower(p[:i]))
+ result.append(p[:i].lower())
return result
def getencoding(self):
if self.encodingheader is None:
return '7bit'
- return string.lower(self.encodingheader)
+ return self.encodingheader.lower()
def gettype(self):
return self.type