TL;DR

Oslo deprecated isotime() and some other functions in oslo_utils.timeutils a 
while back. The recommended route was to just use datetime.isoformat() instead. 
In researching this for Trove, I found that several projects instead handled 
the situation by cloning the code into their own projects. This seems like an 
[unintended/unfortunate/avoidable] consequence.

In [1] I propose a change for Trove to address this and believe that this 
solution should meet the needs not only of other projects that were using 
isotime() and is, I believe, something that should really go into 
oslo_utils.timeutils and be shared across projects.

The whole story ...

Three attempts have been made to handle the deprecation of isotime() in Trove. 
The deprecation itself happened in [2].

Some projects that didn't just use datetime.datetime.isoformat() as suggested 
can be seen in [3], [4] and [5]. Those are in keystone, glance and nova which 
is why I've tagged those projects on the subject of this email.

As best as I can tell, the issue(s) with timeutils.isotime() are that it was 
willfully naïve, in that it assumed UTC even when it could determine otherwise.

The issue with datetime.isoformat() that led people to replicate the (soon to 
be deprecated) code in timeutils.isotime() was that they didn't want the 
disruptions that would come from the change. This is because isoformat() 
produces a very specific output that includes subsecond information, and 
identifies UTC Timezone as +00:00 rather than just 'Z'.

It turns out that the output produced by timeutils.isotime() is in fact ISO 
8601 compliant and the issue really was that it was *A* valid format while 
datetime.isoformat() is *A* different but also valid ISO 8601 format.

In Trove, I too don't want to change the format of output (in API for example) 
and chose to split the difference; use the perfectly valid ISO 8601 format with 
Z and no subsecond information for UTC and the +/-NN:NN format for all other 
timezones.

I suspect that this should have all the benefits of isoformat() and require no 
changes in existing client code and therefore should reasonably work in 
oslo_utils.timeutils.

Thanks,

-amrith


[1] https://review.openstack.org/#/c/326655/1/trove/common/timeutils.py
[2] https://review.openstack.org/#/c/182602/
[3] https://review.openstack.org/#/c/187751/
[4] https://review.openstack.org/#/c/253517/
[5] https://review.openstack.org/#/c/241179/



__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

Reply via email to