mirror of https://github.com/python/cpython
Message.getheaders(): If there are no matching headers, return an
empty list instead of None. (Guido's request.)
This commit is contained in:
parent
7df4dd7de2
commit
cbfa5cbcc8
|
@ -288,7 +288,8 @@ class Message:
|
||||||
|
|
||||||
This returns a list of values for headers given more than once;
|
This returns a list of values for headers given more than once;
|
||||||
each value in the result list is stripped in the same way as the
|
each value in the result list is stripped in the same way as the
|
||||||
result of getheader(). If the header is not given, return None.
|
result of getheader(). If the header is not given, return an
|
||||||
|
empty list.
|
||||||
"""
|
"""
|
||||||
result = []
|
result = []
|
||||||
current = ''
|
current = ''
|
||||||
|
@ -306,7 +307,7 @@ class Message:
|
||||||
have_header = 1
|
have_header = 1
|
||||||
if have_header:
|
if have_header:
|
||||||
result.append(current)
|
result.append(current)
|
||||||
return result or None
|
return result
|
||||||
|
|
||||||
def getaddr(self, name):
|
def getaddr(self, name):
|
||||||
"""Get a single address from a header, as a tuple.
|
"""Get a single address from a header, as a tuple.
|
||||||
|
|
Loading…
Reference in New Issue