Ticket #2208: 0001-time-data-.-does-not-match-format-Y-m-dT-H-M-S-2208.patch

File 0001-time-data-.-does-not-match-format-Y-m-dT-H-M-S-2208.patch, 1.2 KB (added by alsroot, 11 years ago)
  • src/jarabe/journal/misc.py

    From b3ddf193efae1ac7ebd7f8b367c9f3cfec23bf34 Mon Sep 17 00:00:00 2001
    From: Aleksey Lim <alsroot@member.fsf.org>
    Date: Tue, 31 Aug 2010 13:26:05 +0000
    Subject: [PATCH] time data ... does not match format '%Y-%m-%dT%H:%M:%S' #2208
    
    ---
     src/jarabe/journal/misc.py |    8 ++++++--
     1 files changed, 6 insertions(+), 2 deletions(-)
    
    diff --git a/src/jarabe/journal/misc.py b/src/jarabe/journal/misc.py
    index 657b60e..63cccfa 100644
    a b def get_date(metadata): 
    8787        timestamp = float(metadata['timestamp'])
    8888        return util.timestamp_to_elapsed_string(timestamp)
    8989    elif metadata.has_key('mtime'):
    90         ti = time.strptime(metadata['mtime'], "%Y-%m-%dT%H:%M:%S")
    91         return util.timestamp_to_elapsed_string(time.mktime(ti))
     90        try:
     91            ti = time.strptime(metadata['mtime'], "%Y-%m-%dT%H:%M:%S")
     92            return util.timestamp_to_elapsed_string(time.mktime(ti))
     93        except (ValueError, TypeError):
     94            logging.warning('Bad mtime metadata field: %r', metadata['mtime'])
     95            return util.timestamp_to_elapsed_string(0)
    9296    else:
    9397        return _('No date')
    9498