summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alot/db.py12
-rw-r--r--alot/message.py7
-rw-r--r--alot/widgets.py9
3 files changed, 24 insertions, 4 deletions
diff --git a/alot/db.py b/alot/db.py
index 621789ae..d904c3be 100644
--- a/alot/db.py
+++ b/alot/db.py
@@ -204,8 +204,16 @@ class Thread(object):
self._authors = thread.get_authors()
self._subject = thread.get_subject()
ts = thread.get_oldest_date()
- self._oldest_date = datetime.fromtimestamp(ts)
- self._newest_date = datetime.fromtimestamp(thread.get_newest_date())
+
+ try:
+ self._oldest_date = datetime.fromtimestamp(ts)
+ except ValueError: # year is out of range
+ self._oldest_date = None
+ try:
+ self._newest_date = datetime.fromtimestamp(thread.get_newest_date())
+ except ValueError: # year is out of range
+ self._newest_date = None
+
self._tags = set([t for t in thread.get_tags()])
self._messages = {} # this maps messages to its children
self._toplevel_messages = []
diff --git a/alot/message.py b/alot/message.py
index 71760ad5..f7634649 100644
--- a/alot/message.py
+++ b/alot/message.py
@@ -43,7 +43,10 @@ class Message(object):
self._id = msg.get_message_id()
self._thread_id = msg.get_thread_id()
self._thread = thread
- self._datetime = datetime.fromtimestamp(msg.get_date())
+ try:
+ self._datetime = datetime.fromtimestamp(msg.get_date())
+ except ValueError: # year is out of range
+ self._datetime = None
self._filename = msg.get_filename()
self._from = msg.get_header('From')
self._email = None # will be read upon first use
@@ -117,6 +120,8 @@ class Message(object):
def get_datestring(self):
"""returns formated datestring"""
+ if self._datetime == None:
+ return None
formatstring = config.get('general', 'timestamp_format')
if formatstring:
res = self._datetime.strftime(formatstring)
diff --git a/alot/widgets.py b/alot/widgets.py
index 079d082a..6a50dd6c 100644
--- a/alot/widgets.py
+++ b/alot/widgets.py
@@ -470,7 +470,13 @@ class MessageSummaryWidget(urwid.WidgetWrap):
urwid.WidgetWrap.__init__(self, txt)
def __str__(self):
- return self.message.__str__()
+ author, address = self.message.get_author()
+ date = self.message.get_datestring()
+ if date == None:
+ rep = author
+ else:
+ rep = '%s (%s)' % (author, date)
+ return rep
def selectable(self):
return True
@@ -525,6 +531,7 @@ class MessageHeaderWidget(urwid.AttrMap):
max_key_len = len(key)
for key in displayed:
#todo: parse from,cc,bcc seperately into name-addr-widgets
+ # TODO: check indexed keys for None and highlight as invalid
if key in self.eml:
value = message.decode_header(self.eml.get(key))
keyw = ('fixed', max_key_len + 1,