hgkw/keyword.py
changeset 1141 4e2090ed2e72
parent 1121 f4dcce73f362
child 1145 446f29d60749
equal deleted inserted replaced
1140:689f8b6b711c 1141:4e2090ed2e72
   115 
   115 
   116 # date like in cvs' $Date
   116 # date like in cvs' $Date
   117 def utcdate(text):
   117 def utcdate(text):
   118     ''':utcdate: Date. Returns a UTC-date in this format: "2009/08/18 11:00:13".
   118     ''':utcdate: Date. Returns a UTC-date in this format: "2009/08/18 11:00:13".
   119     '''
   119     '''
   120     return util.datestr((text[0], 0), '%Y/%m/%d %H:%M:%S')
   120     return util.datestr((util.parsedate(text)[0], 0), '%Y/%m/%d %H:%M:%S')
   121 # date like in svn's $Date
   121 # date like in svn's $Date
   122 def svnisodate(text):
   122 def svnisodate(text):
   123     ''':svnisodate: Date. Returns a date in this format: "2009-08-18 13:00:13
   123     ''':svnisodate: Date. Returns a date in this format: "2009-08-18 13:00:13
   124     +0200 (Tue, 18 Aug 2009)".
   124     +0200 (Tue, 18 Aug 2009)".
   125     '''
   125     '''
   127 # date like in svn's $Id
   127 # date like in svn's $Id
   128 def svnutcdate(text):
   128 def svnutcdate(text):
   129     ''':svnutcdate: Date. Returns a UTC-date in this format: "2009-08-18
   129     ''':svnutcdate: Date. Returns a UTC-date in this format: "2009-08-18
   130     11:00:13Z".
   130     11:00:13Z".
   131     '''
   131     '''
   132     return util.datestr((text[0], 0), '%Y-%m-%d %H:%M:%SZ')
   132     return util.datestr((util.parsedate(text)[0], 0), '%Y-%m-%d %H:%M:%SZ')
   133 
   133 
   134 templatefilters.filters.update({'utcdate': utcdate,
   134 templatefilters.filters.update({'utcdate': utcdate,
   135                                 'svnisodate': svnisodate,
   135                                 'svnisodate': svnisodate,
   136                                 'svnutcdate': svnutcdate})
   136                                 'svnutcdate': svnutcdate})
   137 
   137