Replace (int, long) with six.integer_types

Python 3 hasn't type 'long', there is only integer type 'int',
which mostly behaves like the long type in Python 2.

Partially-Implements: bp py3-compatibility

Change-Id: I78eb93837cbe137c9ce4dd1b3cf0f4744696ade4
This commit is contained in:
Julia Varlamova 2015-07-30 02:48:36 -04:00
parent 83107dd849
commit 3500bd64cd
2 changed files with 4 additions and 2 deletions

View File

@ -431,7 +431,7 @@ class DbQuotaDriver(object):
# Set up the reservation expiration
if expire is None:
expire = CONF.reservation_expire
if isinstance(expire, (int, long)):
if isinstance(expire, six.integer_types):
expire = datetime.timedelta(seconds=expire)
if isinstance(expire, datetime.timedelta):
expire = timeutils.utcnow() + expire

View File

@ -473,7 +473,9 @@ class NaElement(object):
child = NaElement(key)
child.add_child_elem(value)
self.add_child_elem(child)
elif isinstance(value, (str, int, float, long)):
elif isinstance(
value,
six.string_types + six.integer_types + (float, )):
self.add_new_child(key, six.text_type(value))
elif isinstance(value, (list, tuple, dict)):
child = NaElement(key)