From a08daf15d42890a16af0a60ceadd0aaced04ef7f Mon Sep 17 00:00:00 2001 From: Flaper Fesp Date: Fri, 4 Jan 2013 18:07:45 +0100 Subject: Use basestring instead of str for type check. Change-Id: I1dbf453cc08bd8aaeb4fee2491a1e8aa74f8bee3 introduced some checks to is_older_than and is_newer_than functions against str instead of basestring. I'm aware that basestring doesn't exist in Python3 but since it isn't a target right now and there's no "standard" way to support it right now in openstack. Change-Id: I8d67d384637dfdde3f5621052d8511e7b6ecab7b --- openstack/common/timeutils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'openstack') diff --git a/openstack/common/timeutils.py b/openstack/common/timeutils.py index e518733..0f34608 100644 --- a/openstack/common/timeutils.py +++ b/openstack/common/timeutils.py @@ -71,14 +71,14 @@ def normalize_time(timestamp): def is_older_than(before, seconds): """Return True if before is older than seconds.""" - if isinstance(before, str): + if isinstance(before, basestring): before = parse_strtime(before).replace(tzinfo=None) return utcnow() - before > datetime.timedelta(seconds=seconds) def is_newer_than(after, seconds): """Return True if after is newer than seconds.""" - if isinstance(after, str): + if isinstance(after, basestring): after = parse_strtime(after).replace(tzinfo=None) return after - utcnow() > datetime.timedelta(seconds=seconds) -- cgit