Fix circular reference error for lists of Object Ids
Ensure that objects returned by the 'ref' function (ObjectIDs) are serialized. Co-Authored-By: Stan Lagun <slagun@mirantis.com> Change-Id: I305a0b03fec466ec03753655deb1fa7e11c88d89 Closes-Bug: #1721608
This commit is contained in:
parent
6db87d8094
commit
1882bb264f
@ -110,16 +110,15 @@ def insert_hidden_ids(application):
|
||||
v.get('id'), ObjectID):
|
||||
v['id'] = str(uuid.uuid4())
|
||||
return k, v
|
||||
elif isinstance(v, ObjectID):
|
||||
return k, v.object_id
|
||||
else:
|
||||
return rec(k), rec(v)
|
||||
return rec(k), rec(v)
|
||||
|
||||
def rec(val):
|
||||
if isinstance(val, dict):
|
||||
return dict(wrap(k, v) for k, v in six.iteritems(val))
|
||||
elif isinstance(val, list):
|
||||
return [rec(v) for v in val]
|
||||
elif isinstance(val, ObjectID):
|
||||
return val.object_id
|
||||
else:
|
||||
return val
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user