From 100bc3c5e7f44a2ef7fb3be3c10c368ac8c9037e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Wed, 27 Feb 2019 16:23:57 +0200 Subject: [PATCH] Fix a "invalid time format" in front.views.status_single on Windows hosts. Fixes #224 --- CHANGELOG.md | 1 + hc/front/tests/test_status_single.py | 2 +- hc/front/views.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b76d08c7..e4f0e04e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file. ### Bug Fixes - Fix refreshing of the checks page filtered by tags (#221) - Escape asterisks in Slack messages (#223) +- Fix a "invalid time format" in front.views.status_single on Windows hosts ## 1.5.0 - 2019-02-04 diff --git a/hc/front/tests/test_status_single.py b/hc/front/tests/test_status_single.py index cb806c8a..c494cccc 100644 --- a/hc/front/tests/test_status_single.py +++ b/hc/front/tests/test_status_single.py @@ -29,7 +29,7 @@ class StatusSingleTestCase(BaseTestCase): doc = r.json() self.assertEqual(doc["status"], "up") - self.assertEqual(doc["updated"], p.created.strftime("%s.%f")) + self.assertEqual(doc["updated"], str(p.created.timestamp())) self.assertTrue("test-user-agent" in doc["events"]) def test_it_omits_events(self): diff --git a/hc/front/views.py b/hc/front/views.py index 070248ec..4737e6ce 100644 --- a/hc/front/views.py +++ b/hc/front/views.py @@ -494,7 +494,7 @@ def status_single(request, code): events = _get_events(check, 20) updated = "1" if len(events): - updated = events[0].created.strftime("%s.%f") + updated = str(events[0].created.timestamp()) doc = { "status": status,