From 42eabcf6612f435979b3fbdb62f1d7622a549ea2 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sun, 19 Jan 2020 15:37:55 +0100 Subject: [PATCH] More robust ISO date to timestamp conversion --- platypush/backend/travisci.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/platypush/backend/travisci.py b/platypush/backend/travisci.py index f00e897ae..8000c29d2 100644 --- a/platypush/backend/travisci.py +++ b/platypush/backend/travisci.py @@ -35,6 +35,9 @@ class TravisciBackend(Backend): @staticmethod def _convert_iso_date(d): + if not d: + return + if isinstance(d, int) or isinstance(d, float): return d @@ -43,7 +46,7 @@ class TravisciBackend(Backend): d = d[:-1] + '+00:00' d = datetime.datetime.fromisoformat(d) - assert isinstance(d, datetime.datetime) + assert isinstance(d, datetime.datetime), 'Unexpected datetime type: ' + type(d) return d.timestamp() def __enter__(self):