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:
parent
83107dd849
commit
3500bd64cd
@ -431,7 +431,7 @@ class DbQuotaDriver(object):
|
|||||||
# Set up the reservation expiration
|
# Set up the reservation expiration
|
||||||
if expire is None:
|
if expire is None:
|
||||||
expire = CONF.reservation_expire
|
expire = CONF.reservation_expire
|
||||||
if isinstance(expire, (int, long)):
|
if isinstance(expire, six.integer_types):
|
||||||
expire = datetime.timedelta(seconds=expire)
|
expire = datetime.timedelta(seconds=expire)
|
||||||
if isinstance(expire, datetime.timedelta):
|
if isinstance(expire, datetime.timedelta):
|
||||||
expire = timeutils.utcnow() + expire
|
expire = timeutils.utcnow() + expire
|
||||||
|
@ -473,7 +473,9 @@ class NaElement(object):
|
|||||||
child = NaElement(key)
|
child = NaElement(key)
|
||||||
child.add_child_elem(value)
|
child.add_child_elem(value)
|
||||||
self.add_child_elem(child)
|
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))
|
self.add_new_child(key, six.text_type(value))
|
||||||
elif isinstance(value, (list, tuple, dict)):
|
elif isinstance(value, (list, tuple, dict)):
|
||||||
child = NaElement(key)
|
child = NaElement(key)
|
||||||
|
Loading…
Reference in New Issue
Block a user