]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backporting:
authorBarry Warsaw <barry@python.org>
Fri, 4 Apr 2003 02:46:38 +0000 (02:46 +0000)
committerBarry Warsaw <barry@python.org>
Fri, 4 Apr 2003 02:46:38 +0000 (02:46 +0000)
    revision 1.27
    date: 2003/03/30 20:46:47;  author: bwarsaw;  state: Exp;  lines: +3 -3
    __unicode__(): Fix the logic for calculating whether to add a
    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)))