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
0ebc5c96
Commit
0ebc5c96
authored
Oct 01, 2002
by
Barry Warsaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Docstring consistency with the updated .tex files.
parent
12272a2f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
Lib/email/Utils.py
Lib/email/Utils.py
+15
-6
No files found.
Lib/email/Utils.py
View file @
0ebc5c96
...
...
@@ -221,12 +221,12 @@ def formatdate(timeval=None, localtime=False):
def
make_msgid
(
idstring
=
None
):
"""Returns a string suitable for RFC 2822 compliant Message-ID
:
, e.g:
"""Returns a string suitable for RFC 2822 compliant Message-ID, e.g:
<20020201195627.33539.96671@nightshade.la.mastaler.com>
Optional idstring if given is a string used to strengthen the
uniqueness of the
Message-ID, otherwise an empty string is use
d.
uniqueness of the
message i
d.
"""
timeval
=
time
.
time
()
utcdate
=
time
.
strftime
(
'%Y%m%d%H%M%S'
,
time
.
gmtime
(
timeval
))
...
...
@@ -286,19 +286,28 @@ def decode_rfc2231(s):
def
encode_rfc2231
(
s
,
charset
=
None
,
language
=
None
):
"""Encode string according to RFC 2231"""
"""Encode string according to RFC 2231.
If neither charset nor language is given, then s is returned as-is. If
charset is given but not language, the string is encoded using the empty
string for language.
"""
import
urllib
s
=
urllib
.
quote
(
s
,
safe
=
''
)
if
charset
is
None
and
language
is
None
:
return
s
else
:
return
"%s'%s'%s"
%
(
charset
,
language
,
s
)
if
language
is
None
:
language
=
''
return
"%s'%s'%s"
%
(
charset
,
language
,
s
)
rfc2231_continuation
=
re
.
compile
(
r'^(?P<name>\
w+)
\*((?P<num>[0-9]+)\
*?)?$
')
def decode_params(params):
"""Decode parameters list according to RFC 2231"""
"""Decode parameters list according to RFC 2231.
params is a sequence of 2-tuples containing (content type, string value).
"""
new_params = []
# maps parameter'
s
name
to
a
list
of
continuations
rfc2231_params
=
{}
...
...
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