Comment 2 for bug 1242501

Revision history for this message
Zhi Yan Liu (lzy-dev) wrote :

The root causes is that the current latest version for iso8601 is 0.1.7, its "parse_date()" util function could successfully handle datestring param which missing the time part like "2011-09-05". This behavior is different then iso8601-0.1.4, our test case code assume iso8601 always raise an exception when it parse the datestring withich don't have time part.

https://github.com/openstack/glance/blob/master/glance/openstack/common/timeutils.py#L52
https://github.com/openstack/glance/blob/master/glance/registry/api/v1/images.py#L215

I prefer fix this via change test case code but don't cap iso8601 version in requirement.txt (such as <0.1.7), one thing here I'm concerning is that do we need to update some user doc? since glance can support yyyy-mm-dd param (no time part) as "changes-since" filter param for the image-list query request, like"2011-09-05".

## iso8601-0.1.7
>>> import iso8601
>>> iso8601.parse_date('2011-09-05')
datetime.datetime(2011, 9, 5, 0, 0, tzinfo=<iso8601.iso8601.Utc object at 0x1c3da50>

## iso8601-0.1.4
>>> import iso8601
>>> iso8601.parse_date('2011-09-05')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/lzy/workspace/openstack-org/glance/.venv/local/lib/python2.7/site-packages/iso8601/iso8601.py", line 101, in parse_date
    int(groups["hour"]), int(groups["minute"]), int(groups["second"]),
TypeError: int() argument must be a string or a number, not 'NoneType'

btw, for my above comments, in my dev env, the venv is using iso8601-0.1.4 but tox is using iso8601-0.1.7, so run_tests.sh could return success but tox.