diff options
author | Monty Taylor <mordred@inaugust.com> | 2017-12-02 11:11:23 -0600 |
---|---|---|
committer | Monty Taylor <mordred@inaugust.com> | 2017-12-02 11:15:26 -0600 |
commit | f0c9b20e0fd512e4eaa3f041a02afd80b871fe75 (patch) | |
tree | 0e5089b97bfed47bc7af0476aa4b20c585b5d96a /tox.ini | |
parent | 789301a388ba7e190de21e54300b0bb8e0ed6d18 (diff) | |
download | python-keystoneclient-f0c9b20e0fd512e4eaa3f041a02afd80b871fe75.tar.gz |
Handle UTC+00:00 in datetime strings
In some cases, the following:
datetime.datetime.now(tz=iso8601.iso8601.UTC).tzinfo.tzname()
returns:
'UTC+00:00'
rather than:
'UTC'
resulting in strings that look like:
2013-03-04T12:00:01.000000UTC+00:00
That is just flatly invalid. The code here accounts for a tzname of
"UTC" and normalizes to to being a trailing Z as-per the ISO 8601 spec,
but it does not account for UTC+00:00. Add support for that so that we
don't produce invalid date strings.
Most of this can be avoided by replacing use of this function with the
isoformat method of datetime instead.
datetime.datetime.now(tz=iso8601.iso8601.UTC).isoformat()
Produces
2013-03-04T12:00:01.000000+00:00
Which while different from
2013-03-04T12:00:01.000000Z
is still a valid iso8601 string.
Change-Id: I52ca7561abee158285c2c98ba63d84c62e12360f
Diffstat (limited to 'tox.ini')
0 files changed, 0 insertions, 0 deletions