summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2002-10-01 00:44:13 (GMT)
committerBarry Warsaw <barry@python.org>2002-10-01 00:44:13 (GMT)
commit0ebc5c96c5b79ee4f3fe77f79d15b0b905343f5c (patch)
tree7f17f4262ada2d44c2b53ced5d1dcbd9db86e3a9 /Lib
parent12272a2f22a3a01c9a5e8d70b643fe6200209c1c (diff)
downloadcpython-0ebc5c96c5b79ee4f3fe77f79d15b0b905343f5c.zip
cpython-0ebc5c96c5b79ee4f3fe77f79d15b0b905343f5c.tar.gz
cpython-0ebc5c96c5b79ee4f3fe77f79d15b0b905343f5c.tar.bz2
Docstring consistency with the updated .tex files.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/email/Utils.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/Lib/email/Utils.py b/Lib/email/Utils.py
index 4857608..b619c6b 100644
--- a/Lib/email/Utils.py
+++ b/Lib/email/Utils.py
@@ -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 used.
+ uniqueness of the message id.
"""
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 = {}