From 634d8bc2efef536008632728a27127eb230b1170 Mon Sep 17 00:00:00 2001 From: Kengo Takahara Date: Fri, 9 Mar 2018 16:41:06 +0900 Subject: [PATCH] Fix for difference in tzinfo.tzname value between py27 and py35 The tzinfo.tzname value differs between py27 and py35. For example, 'UTC' for py27, 'UTC+00:00' for py35. Therefore, it is necessary to change the way to get the date string. Change-Id: Iae5539e0aec0fab0a08640f7f6600a1d91b241e5 Closes-Bug: #1753644 --- masakari/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/masakari/utils.py b/masakari/utils.py index 01ac30cb..056fdbee 100644 --- a/masakari/utils.py +++ b/masakari/utils.py @@ -152,7 +152,7 @@ def isotime(at=None): at = timeutils.utcnow() date_string = at.strftime("%Y-%m-%dT%H:%M:%S") tz = at.tzinfo.tzname(None) if at.tzinfo else 'UTC' - date_string += ('Z' if tz == 'UTC' else tz) + date_string += ('Z' if tz in ['UTC', 'UTC+00:00'] else tz) return date_string