Commit ad992d3a authored by Spiros Koulouzis's avatar Spiros Koulouzis

fixed missing key error

parent 4a41f8fd
...@@ -42,8 +42,12 @@ def query_db(queries, db=None): ...@@ -42,8 +42,12 @@ def query_db(queries, db=None):
updated_results = [] updated_results = []
for res in results: for res in results:
if root_key in res: if root_key in res:
key = res[root_key] res_copy = copy.deepcopy(res)
node = {key: res} key = res_copy[root_key]
res_copy.pop(root_key)
node = {key: res_copy}
else:
logging.error(str(res)+ ' has no '+root_key)
updated_results.append(node) updated_results.append(node)
return updated_results return updated_results
return None return None
...@@ -65,6 +69,7 @@ def get_tosca_template(tosca_template_dict): ...@@ -65,6 +69,7 @@ def get_tosca_template(tosca_template_dict):
def get_tosca_template_dict_by_id(id): def get_tosca_template_dict_by_id(id):
tosca_template_dict = tosca_templates_db.get(doc_id=int(id)) tosca_template_dict = tosca_templates_db.get(doc_id=int(id))
return tosca_template_dict return tosca_template_dict
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment