]> granicus.if.org Git - python/commitdiff
__unicode__(): Fix the logic for calculating whether to add a
authorBarry Warsaw <barry@python.org>
Sun, 30 Mar 2003 20:46:47 +0000 (20:46 +0000)
committerBarry Warsaw <barry@python.org>
Sun, 30 Mar 2003 20:46:47 +0000 (20:46 +0000)
separating space or not between encoded chunks.  Closes SF bug
#710498.

Lib/email/Header.py

index 624e7c445b91007f552d5803964577c77d89d9b8..76fffb597056831689e7dff222f14dec7cd60358 100644 (file)
@@ -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)))