compute: fixes python 3 related unit tests

Fixes volume related unit tests.
Fixes non-sortable None items.
Fixes __getattr__ infinite recursion.
Fixes is_dict_like method. Dicts in python 3.4 do not
have the 'has_key' method.

Partially Implements: blueprint goal-python35

Change-Id: I97efc09f7657436f706b08e0b2795f0e59ac1dcd
This commit is contained in:
Claudiu Belu 2016-04-01 03:22:39 +03:00
parent 819b3b415e
commit 1178d82670

View File

@ -732,7 +732,7 @@ def temporary_mutation(obj, **kwargs):
do_something_that_needed_deleted_objects()
"""
def is_dict_like(thing):
return hasattr(thing, 'has_key')
return hasattr(thing, 'has_key') or isinstance(thing, dict)
def get(thing, attr, default):
if is_dict_like(thing):