summaryrefslogtreecommitdiffstats
path: root/Lib/email
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2011-03-25 19:31:52 (GMT)
committerR David Murray <rdmurray@bitdance.com>2011-03-25 19:31:52 (GMT)
commit961355a56a7a896c7ea4ad7416f0cf74a50852a9 (patch)
treeaf6101ff06aa416d88f8bf1816104cccd45598c8 /Lib/email
parentfd2c2a5271a00795372e9dae22a4c20d8d0807cf (diff)
parent041015cc70465c8a008d4ef45ffe3fe05041fad2 (diff)
downloadcpython-961355a56a7a896c7ea4ad7416f0cf74a50852a9.zip
cpython-961355a56a7a896c7ea4ad7416f0cf74a50852a9.tar.gz
cpython-961355a56a7a896c7ea4ad7416f0cf74a50852a9.tar.bz2
Merge #11584: Since __getitem__ returns headers, make decode_header handle them.
Diffstat (limited to 'Lib/email')
-rw-r--r--Lib/email/header.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/email/header.py b/Lib/email/header.py
index 8c32514..2562b30 100644
--- a/Lib/email/header.py
+++ b/Lib/email/header.py
@@ -66,9 +66,15 @@ def decode_header(header):
otherwise a lower-case string containing the name of the character set
specified in the encoded string.
+ header may be a string that may or may not contain RFC2047 encoded words,
+ or it may be a Header object.
+
An email.errors.HeaderParseError may be raised when certain decoding error
occurs (e.g. a base64 decoding exception).
"""
+ # If it is a Header object, we can just return the chunks.
+ if hasattr(header, '_chunks'):
+ return list(header._chunks)
# If no encoding, just return the header with no charset.
if not ecre.search(header):
return [(header, None)]