Corrected several usage of keys() for Python 3
Under Python2 dict.keys() returns a list, under Python 3 it returns an iterator. Some places assumed that if they called keys() then it was safe to modify the dict in a loop. Corrected this by calling list(). Change-Id: I7638263f288dd20590bd751d09194a919b921545
This commit is contained in:
parent
8deaf3769d
commit
35e03a92e2
|
@ -613,7 +613,7 @@ class FakeHTTPClient(base_client.HTTPClient):
|
|||
def get_flavors(self, **kw):
|
||||
status, header, flavors = self.get_flavors_detail(**kw)
|
||||
for flavor in flavors['flavors']:
|
||||
for k in flavor.keys():
|
||||
for k in list(flavor):
|
||||
if k not in ['id', 'name']:
|
||||
del flavor[k]
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ class QuotaClassSetManager(base.Manager):
|
|||
'security_groups': security_groups,
|
||||
'security_group_rules': security_group_rules}}
|
||||
|
||||
for key in body['quota_class_set'].keys():
|
||||
for key in list(body['quota_class_set']):
|
||||
if body['quota_class_set'][key] is None:
|
||||
body['quota_class_set'].pop(key)
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ class QuotaSetManager(base.Manager):
|
|||
'security_group_rules': security_group_rules,
|
||||
'force': force}}
|
||||
|
||||
for key in body['quota_set'].keys():
|
||||
for key in list(body['quota_set']):
|
||||
if body['quota_set'][key] is None:
|
||||
body['quota_set'].pop(key)
|
||||
|
||||
|
|
Loading…
Reference in New Issue