summaryrefslogtreecommitdiff
path: root/alot/helper.py
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2012-12-02 18:40:06 +0000
committerPatrick Totzke <patricktotzke@gmail.com>2012-12-02 18:40:06 +0000
commitace13f292d9a780ccefab3bcec01b97e6e98748f (patch)
tree1250aa1bc74d71d63821ce9cff6dc608e92ae1e0 /alot/helper.py
parent09804636609b4245cde4faceddffdb5361f3d390 (diff)
fix issue with empty authors strings
helper.shorten_authors_string was not able to deal with nonempty whitespaces only as author's realnames. cf issue #530.
Diffstat (limited to 'alot/helper.py')
-rw-r--r--alot/helper.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/alot/helper.py b/alot/helper.py
index 6cb8d82c..2df22493 100644
--- a/alot/helper.py
+++ b/alot/helper.py
@@ -5,7 +5,6 @@
from datetime import timedelta
from datetime import datetime
from collections import deque
-from string import strip
import subprocess
import shlex
import email
@@ -179,7 +178,9 @@ def shorten_author_string(authors_string, maxlength):
short_names = len(authors_string) > maxlength
for au in authors_string.split(", "):
if short_names:
- authors.append(strip(au.split()[0]))
+ author_as_list = au.split()
+ if len(author_as_list) > 0:
+ authors.append(author_as_list[0])
else:
authors.append(au)
@@ -187,6 +188,9 @@ def shorten_author_string(authors_string, maxlength):
# concatenated using commas for the final formatted author_string.
authors_chain = deque()
+ if len(authors) == 0:
+ return u''
+
# reserve space for first author
first_au = shorten(authors.popleft(), maxlength)
remaining_length = maxlength - len(first_au)