is_older_than and is_newer_than don't support timezone aware datetimes

Bug #1259383 reported by Michael H Wilson
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
oslo-incubator
Fix Released
Undecided
Michael H Wilson

Bug Description

Pass a datetime that is offset aware into openstack.common.timeutils.is_newer_than or is_older_than and you will get this:

TypeError: can't subtract offset-naive and offset-aware datetimes

See https://review.openstack.org/#/c/60992/ Patch set #1 for another example.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo-incubator (master)

Fix proposed to branch: master
Review: https://review.openstack.org/61007

Changed in oslo:
assignee: nobody → Michael H Wilson (geekinutah)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo-incubator (master)

Reviewed: https://review.openstack.org/61007
Committed: https://git.openstack.org/cgit/openstack/oslo-incubator/commit/?id=ae931a937ea95fc13d873d4c71de7d0407dd5fb5
Submitter: Jenkins
Branch: master

commit ae931a937ea95fc13d873d4c71de7d0407dd5fb5
Author: Michael Wilson <email address hidden>
Date: Mon Dec 9 21:26:34 2013 -0700

    Avoid TypeError in is_older_than, is_newer_than

    datetime doesn't like to subtract offset-naive and
    offset-aware datetimes. To fix this we convert all
    datetimes that are passed in to offset-naive objects.

    Change-Id: Ib01568c9d287e319750b6bef3656fdcfc992a1b1
    Closes-Bug: #1259383

Changed in oslo:
status: In Progress → Fix Committed
Changed in oslo:
milestone: none → icehouse-2
Thierry Carrez (ttx)
Changed in oslo:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in oslo:
milestone: icehouse-2 → 2014.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.