summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2003-03-30 20:46:47 (GMT)
committerBarry Warsaw <barry@python.org>2003-03-30 20:46:47 (GMT)
commitba1548a7362aecf4c94523579486fed62de12d15 (patch)
tree101e734e5ab20a0215eaa3bb32e2fdbe8a3767e7
parent742dde4ddd178ee5ac80ae0d4a599a67437d9635 (diff)
downloadcpython-ba1548a7362aecf4c94523579486fed62de12d15.zip
cpython-ba1548a7362aecf4c94523579486fed62de12d15.tar.gz
cpython-ba1548a7362aecf4c94523579486fed62de12d15.tar.bz2
__unicode__(): Fix the logic for calculating whether to add a
separating space or not between encoded chunks. Closes SF bug #710498.
-rw-r--r--Lib/email/Header.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/email/Header.py b/Lib/email/Header.py
index 624e7c4..76fffb5 100644
--- a/Lib/email/Header.py
+++ b/Lib/email/Header.py
@@ -215,11 +215,11 @@ class Header:
# charset. Only do this for the second and subsequent chunks.
nextcs = charset
if uchunks:
- if lastcs is not None:
- if nextcs is None or nextcs == 'us-ascii':
+ if lastcs not in (None, 'us-ascii'):
+ if nextcs in (None, 'us-ascii'):
uchunks.append(USPACE)
nextcs = None
- elif nextcs is not None and nextcs <> 'us-ascii':
+ elif nextcs not in (None, 'us-ascii'):
uchunks.append(USPACE)
lastcs = nextcs
uchunks.append(unicode(s, str(charset)))