summaryrefslogtreecommitdiffstats
path: root/openstack
diff options
context:
space:
mode:
authorFlaper Fesp <flaper87@gmail.com>2013-01-04 18:07:45 +0100
committerFlaper Fesp <flaper87@gmail.com>2013-01-04 18:19:15 +0100
commita08daf15d42890a16af0a60ceadd0aaced04ef7f (patch)
tree684ee728d41034a2590980060720bf8e66aaff6f /openstack
parentcad152f0f0593145f3d711b34714758b604415df (diff)
downloadoslo-a08daf15d42890a16af0a60ceadd0aaced04ef7f.tar.gz
oslo-a08daf15d42890a16af0a60ceadd0aaced04ef7f.tar.xz
oslo-a08daf15d42890a16af0a60ceadd0aaced04ef7f.zip
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
Diffstat (limited to 'openstack')
-rw-r--r--openstack/common/timeutils.py4
1 files changed, 2 insertions, 2 deletions
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)