[openstack-dev] [oslo][trove][keystone][glance][nova] on the deprecation of isotime() in oslo.utils
amrith at tesora.com
Tue Jun 7 17:57:21 UTC 2016
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  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 .
Some projects that didn't just use datetime.datetime.isoformat() as suggested can be seen in ,  and . 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.
More information about the OpenStack-dev