diff options
author | Sascha Silbe <sascha-pgp@silbe.org> | 2010-10-17 09:36:09 (GMT) |
---|---|---|
committer | Sascha Silbe <sascha-pgp@silbe.org> | 2010-11-30 10:42:23 (GMT) |
commit | 760deeb2a9eb3d840451823aa3b868b94c388f34 (patch) | |
tree | b20d25df28d8a5b30341e65af2647d1ed2a24042 /src/jarabe/journal/expandedentry.py | |
parent | 5fdb4f3826948c5604d59c58e02585815c01f302 (diff) |
Journal details view: don't choke on invalid timestamp (SL#1590, SL#2208)
Metadata can get corrupted by crashes or malformed by buggy activities.
We should do our best to display the parts that are usable.
Acked-by: Simon Schampijer <simon@schampijer.de>
Diffstat (limited to 'src/jarabe/journal/expandedentry.py')
-rw-r--r-- | src/jarabe/journal/expandedentry.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/jarabe/journal/expandedentry.py b/src/jarabe/journal/expandedentry.py index 725c0f9..9775901 100644 --- a/src/jarabe/journal/expandedentry.py +++ b/src/jarabe/journal/expandedentry.py @@ -280,10 +280,15 @@ class ExpandedEntry(hippo.CanvasBox): def _format_date(self): if 'timestamp' in self._metadata: - timestamp = float(self._metadata['timestamp']) - return time.strftime('%x', time.localtime(timestamp)) - else: - return _('No date') + try: + timestamp = float(self._metadata['timestamp']) + except (ValueError, TypeError): + logging.warning('Invalid timestamp for %r: %r', + self._metadata['uid'], + self._metadata['timestamp']) + else: + return time.strftime('%x', time.localtime(timestamp)) + return _('No date') def _create_buddy_list(self): |