1 |
brianr |
1.1 |
diff -ruN mailman-2.1.12-a/Mailman/Archiver/pipermail.py mailman-2.1.12-b/Mailman/Archiver/pipermail.py |
2 |
|
|
--- mailman-2.1.12-a/Mailman/Archiver/pipermail.py 2009-02-23 22:23:35.000000000 +0100 |
3 |
|
|
+++ mailman-2.1.12-b/Mailman/Archiver/pipermail.py 2009-07-28 12:19:53.000000000 +0200 |
4 |
|
|
@@ -45,24 +45,27 @@ |
5 |
|
|
|
6 |
|
|
def fixAuthor(author): |
7 |
|
|
"Canonicalize a name into Last, First format" |
8 |
|
|
- # If there's a comma, guess that it's already in "Last, First" format |
9 |
|
|
- if ',' in author: |
10 |
|
|
+ try: |
11 |
|
|
+ # If there's a comma, guess that it's already in "Last, First" format |
12 |
|
|
+ if ',' in author: |
13 |
|
|
+ return author |
14 |
|
|
+ L = author.split() |
15 |
|
|
+ i = len(L) - 1 |
16 |
|
|
+ if i == 0: |
17 |
|
|
+ return author # The string's one word--forget it |
18 |
|
|
+ if author.upper() == author or author.lower() == author: |
19 |
|
|
+ # Damn, the name is all upper- or lower-case. |
20 |
|
|
+ while i > 0 and L[i-1].lower() in smallNameParts: |
21 |
|
|
+ i = i - 1 |
22 |
|
|
+ else: |
23 |
|
|
+ # Mixed case; assume that small parts of the last name will be |
24 |
|
|
+ # in lowercase, and check them against the list. |
25 |
|
|
+ while i>0 and (L[i-1][0] in lowercase or |
26 |
|
|
+ L[i-1].lower() in smallNameParts): |
27 |
|
|
+ i = i - 1 |
28 |
|
|
+ author = SPACE.join(L[-1:] + L[i:-1]) + ', ' + SPACE.join(L[:i]) |
29 |
|
|
+ except UnicodeDecodeError: |
30 |
|
|
return author |
31 |
|
|
- L = author.split() |
32 |
|
|
- i = len(L) - 1 |
33 |
|
|
- if i == 0: |
34 |
|
|
- return author # The string's one word--forget it |
35 |
|
|
- if author.upper() == author or author.lower() == author: |
36 |
|
|
- # Damn, the name is all upper- or lower-case. |
37 |
|
|
- while i > 0 and L[i-1].lower() in smallNameParts: |
38 |
|
|
- i = i - 1 |
39 |
|
|
- else: |
40 |
|
|
- # Mixed case; assume that small parts of the last name will be |
41 |
|
|
- # in lowercase, and check them against the list. |
42 |
|
|
- while i>0 and (L[i-1][0] in lowercase or |
43 |
|
|
- L[i-1].lower() in smallNameParts): |
44 |
|
|
- i = i - 1 |
45 |
|
|
- author = SPACE.join(L[-1:] + L[i:-1]) + ', ' + SPACE.join(L[:i]) |
46 |
|
|
return author |
47 |
|
|
|
48 |
|
|
# Abstract class for databases |