Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
5ebc672e
Commit
5ebc672e
authored
Dec 15, 2000
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get rid of string functions.
parent
581f43e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
15 deletions
+14
-15
Lib/mimetools.py
Lib/mimetools.py
+14
-15
No files found.
Lib/mimetools.py
View file @
5ebc672e
...
...
@@ -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
=
str
ing
.
index
(
str
,
';'
)
i
=
str
.
index
(
';'
)
self
.
plisttext
=
str
[
i
:]
str
=
str
[:
i
]
else
:
self
.
plisttext
=
''
fields
=
str
ing
.
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
=
str
ing
.
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
s
tring
.
lower
(
self
.
encodingheader
)
return
s
elf
.
encodingheader
.
lower
(
)
def
gettype
(
self
):
return
self
.
type
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment