From efaad68f5b6a222f1a740b2466142aa06ac42fd3 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Mar 10 2020 21:47:15 +0000 Subject: Don't use datetime timestamp() as it's not in Python 2 The `timestamp()` method for `datetime.datetime` instances was only added in Python 3. It does not exist in Python 2. So we can't safely use it here. I believe this should do the right thing, taking advantage of a couple of existing utility functions in koji.util. Signed-off-by: Adam Williamson --- diff --git a/www/kojiweb/taskinfo.chtml b/www/kojiweb/taskinfo.chtml index c3dd1bb..1622da5 100644 --- a/www/kojiweb/taskinfo.chtml +++ b/www/kojiweb/taskinfo.chtml @@ -1,4 +1,5 @@ #import koji +#import koji.util as kojiutil #from kojiweb import util #from six.moves.urllib.parse import quote #import datetime @@ -97,7 +98,7 @@ #set $end_ts = $task.completion_ts #end if #if not $end_ts - #set $end_ts = datetime.datetime.utcnow().timestamp() + #set $end_ts = $kojiutil.parseTime($kojiutil.encode_datetime(datetime.datetime.utcnow())) #end if Total time