[Bugs] #1590 UNSP: Make timestamp retrieval in Journal more robust

Sugar Labs Bugs bugtracker-noreply at sugarlabs.org
Mon Nov 30 06:08:15 EST 2009


#1590: Make timestamp retrieval in Journal more robust
------------------------------------------+---------------------------------
    Reporter:  sayamindu                  |          Owner:  tomeu                      
        Type:  defect                     |         Status:  new                        
    Priority:  Unspecified by Maintainer  |      Milestone:  Unspecified by Release Team
   Component:  sugar                      |        Version:  Unspecified                
    Severity:  Unspecified                |       Keywords:  r?                         
Distribution:  Unspecified                |   Status_field:  Unconfirmed                
------------------------------------------+---------------------------------

Comment(by sascha_silbe):

 >        try:
 >            timestamp = float(metadata['timestamp'])
 >        except ValueError:
 >            timestamp = None
 >        if timestamp is None:
 >            return _('No date')
 >        else:
 >            return util.timestamp_to_elapsed_string(timestamp)

 How about returning directly in the except clause? There's no other way
 that timestamp can get assigned None and it makes the code easier to read
 and understand.

-- 
Ticket URL: <http://bugs.sugarlabs.org/ticket/1590#comment:2>
Sugar Labs <http://sugarlabs.org/>
Sugar Labs bug tracking system


More information about the Bugs mailing list