add missing format_duration method

This commit is contained in:
Frédéric Péters 2013-02-11 13:55:46 +01:00
parent 1f015639c8
commit fcb14990ae
1 changed files with 11 additions and 0 deletions

View File

@ -42,6 +42,17 @@ class SyncFromThemis(UtilityView):
self.setup()
self.src_url = self.request.form.get('src', self.src_url)
def format_duration(v):
r = ''
if v > 3600:
r = r + '%dh' % int(v/3600)
v = v % 3600
if v > 60 or r:
r = r + '%02dm' % int(v/60)
v = v % 60
r = r + '%02ds' % int(v)
return r
timestamp = self.request.form.get('timestamp')
objects = self.request.form.get('objects', '').split(',')
log.info('sync: start [%r] [%r]' % (timestamp, objects))