Fixes use of dict methods for Python3
In Python3 the dict.keys(), dict.values() and dict.items() methods have been changed to return iterators instead of lists. This causes issues with code that expects a list. bp python3 Change-Id: Id0d55ea4b992666848af1b1a055bc7841548cc6a
This commit is contained in:
parent
bb189ab270
commit
c3077247fe
6
keystone/common/cache/backends/mongo.py
vendored
6
keystone/common/cache/backends/mongo.py
vendored
@ -451,7 +451,7 @@ class MongoApi(object):
|
||||
doc_date = self._get_doc_date()
|
||||
insert_refs = []
|
||||
update_refs = []
|
||||
existing_docs = self._get_results_as_dict(mapping.keys())
|
||||
existing_docs = self._get_results_as_dict(list(mapping.keys()))
|
||||
for key, value in mapping.items():
|
||||
ref = self._get_cache_entry(key, value.payload, value.metadata,
|
||||
doc_date)
|
||||
@ -536,7 +536,7 @@ class BaseTransform(AbstractManipulator):
|
||||
|
||||
def transform_incoming(self, son, collection):
|
||||
"""Used while saving data to MongoDB."""
|
||||
for (key, value) in son.items():
|
||||
for (key, value) in list(son.items()):
|
||||
if isinstance(value, api.CachedValue):
|
||||
son[key] = value.payload # key is 'value' field here
|
||||
son['meta'] = value.metadata
|
||||
@ -553,7 +553,7 @@ class BaseTransform(AbstractManipulator):
|
||||
('_id', 'value', 'meta', 'doc_date')):
|
||||
payload = son.pop('value', None)
|
||||
metadata = son.pop('meta', None)
|
||||
for (key, value) in son.items():
|
||||
for (key, value) in list(son.items()):
|
||||
if isinstance(value, dict):
|
||||
son[key] = self.transform_outgoing(value, collection)
|
||||
if metadata is not None:
|
||||
|
@ -160,7 +160,7 @@ class MockCollection(object):
|
||||
return new
|
||||
if isinstance(obj, dict):
|
||||
new = container()
|
||||
for key, value in obj.items():
|
||||
for key, value in list(obj.items()):
|
||||
new[key] = self._copy_doc(value, container)
|
||||
return new
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user