Commit 9280d34c authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Minor optimade fiexes.

parent db4cb204
......@@ -114,7 +114,7 @@ class CalculationList(Resource):
page_number=page_number,
page_limit=page_limit,
sort=sort, filter=filter),
data=[EntryDataObject(d, request_fields=request_fields) for d in results]
data=[EntryDataObject(d, optimade_type='calculations', request_fields=request_fields) for d in results]
), 200
......@@ -143,7 +143,7 @@ class Calculation(Resource):
return dict(
meta=Meta(query=request.url, returned=1),
data=EntryDataObject(results[0], request_fields=request_fields)
data=EntryDataObject(results[0], optimade_type='calculations', request_fields=request_fields)
), 200
......@@ -341,7 +341,7 @@ class StructureList(Resource):
page_limit=page_limit,
sort=sort, filter=filter
),
data=[EntryDataObject(d, request_fields) for d in results]
data=[EntryDataObject(d, optimade_type='structures', request_fields=request_fields) for d in results]
), 200
......@@ -370,7 +370,7 @@ class Structure(Resource):
return dict(
meta=Meta(query=request.url, returned=1),
data=EntryDataObject(results[0], request_fields=request_fields)
data=EntryDataObject(results[0], optimade_type='structures', request_fields=request_fields)
), 200
......
......@@ -288,7 +288,7 @@ def get_entry_properties():
class EntryDataObject:
def __init__(self, calc: EntryMetadata, request_fields: Set[str] = None):
def __init__(self, calc: EntryMetadata, optimade_type: str, request_fields: Set[str] = None):
def include(key):
if request_fields is None or (key in request_fields):
......@@ -314,7 +314,7 @@ class EntryDataObject:
# if unknown properties where provided, we will ignore them
pass
self.type = 'calculation'
self.type = optimade_type
self.id = calc.calc_id
self.attributes = attrs
......
Supports Markdown
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