areguera / rpms / mailman

Forked from rpms/mailman 4 years ago
Clone

Blame SOURCES/mailman-2.1.9-unicode.patch

49da8b
diff -ruN mailman-2.1.12-a/Mailman/Archiver/pipermail.py mailman-2.1.12-b/Mailman/Archiver/pipermail.py
49da8b
--- mailman-2.1.12-a/Mailman/Archiver/pipermail.py	2009-02-23 22:23:35.000000000 +0100
49da8b
+++ mailman-2.1.12-b/Mailman/Archiver/pipermail.py	2009-07-28 12:19:53.000000000 +0200
49da8b
@@ -45,24 +45,27 @@
49da8b
 
49da8b
 def fixAuthor(author):
49da8b
     "Canonicalize a name into Last, First format"
49da8b
-    # If there's a comma, guess that it's already in "Last, First" format
49da8b
-    if ',' in author:
49da8b
+    try:
49da8b
+        # If there's a comma, guess that it's already in "Last, First" format
49da8b
+        if ',' in author:
49da8b
+            return author
49da8b
+        L = author.split()
49da8b
+        i = len(L) - 1
49da8b
+        if i == 0:
49da8b
+            return author # The string's one word--forget it
49da8b
+        if author.upper() == author or author.lower() == author:
49da8b
+            # Damn, the name is all upper- or lower-case.
49da8b
+            while i > 0 and L[i-1].lower() in smallNameParts:
49da8b
+                i = i - 1
49da8b
+        else:
49da8b
+            # Mixed case; assume that small parts of the last name will be
49da8b
+            # in lowercase, and check them against the list.
49da8b
+            while i>0 and (L[i-1][0] in lowercase or
49da8b
+                           L[i-1].lower() in smallNameParts):
49da8b
+                i = i - 1
49da8b
+        author = SPACE.join(L[-1:] + L[i:-1]) + ', ' + SPACE.join(L[:i])
49da8b
+    except UnicodeDecodeError:
49da8b
         return author
49da8b
-    L = author.split()
49da8b
-    i = len(L) - 1
49da8b
-    if i == 0:
49da8b
-        return author # The string's one word--forget it
49da8b
-    if author.upper() == author or author.lower() == author:
49da8b
-        # Damn, the name is all upper- or lower-case.
49da8b
-        while i > 0 and L[i-1].lower() in smallNameParts:
49da8b
-            i = i - 1
49da8b
-    else:
49da8b
-        # Mixed case; assume that small parts of the last name will be
49da8b
-        # in lowercase, and check them against the list.
49da8b
-        while i>0 and (L[i-1][0] in lowercase or
49da8b
-                       L[i-1].lower() in smallNameParts):
49da8b
-            i = i - 1
49da8b
-    author = SPACE.join(L[-1:] + L[i:-1]) + ', ' + SPACE.join(L[:i])
49da8b
     return author
49da8b
 
49da8b
 # Abstract class for databases