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