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
This commit is contained in:
Kengo Takahara 2018-03-09 16:41:06 +09:00
parent 7b6255af24
commit 634d8bc2ef
1 changed files with 1 additions and 1 deletions

View File

@ -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