summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2016-09-12 09:26:13 (GMT)
committerMartin Pitt <martin.pitt@ubuntu.com>2016-09-12 09:26:31 (GMT)
commit25eef3abae7a6d85b0e82dcc6ae8a559f69ac7b3 (patch)
tree3c3142aee8dde9887732df62ad785a3551473f3e
parentc0b28f888b95925e06df046894d5ab44fff13520 (diff)
webcontrol/browse.cgi: Human readable dates
-rwxr-xr-xwebcontrol/browse.cgi9
1 files changed, 8 insertions, 1 deletions
diff --git a/webcontrol/browse.cgi b/webcontrol/browse.cgi
index fe9f5c7..f40ae1e 100755
--- a/webcontrol/browse.cgi
+++ b/webcontrol/browse.cgi
@@ -7,6 +7,7 @@ import sqlite3
import json
import configparser
import urllib.parse
+import re
import amqplib.client_0_8 as amqp
from wsgiref.handlers import CGIHandler
@@ -71,6 +72,12 @@ def render(template, code=200, **kwargs):
**kwargs), code)
+def human_date(run_id):
+ return re.sub(r'(\d\d\d\d)(\d\d)(\d\d)_(\d\d)(\d\d)(\d\d).*',
+ r'\1-\2-\3 \4:\5:\6 UTC',
+ run_id)
+
+
def human_sec(secs):
return '%ih %02im %02is' % (secs // 3600, (secs % 3600) // 60, secs % 60)
@@ -214,7 +221,7 @@ def package_release_arch(package, release, arch, _=None):
'WHERE test_id=? '
'ORDER BY run_id DESC', (test_id,)):
url = os.path.join(swift_container_url % release, release, arch, srchash(package), package, row[0])
- results.append((row[1], row[2], row[0].rstrip('@'), human_sec(row[3]), human_exitcode(row[4]), url))
+ results.append((row[1], row[2], human_date(row[0]), human_sec(row[3]), human_exitcode(row[4]), url))
return render('browse-results.html',
package=package,