Commit 1ff0ca2e authored by Franziska Koehn's avatar Franziska Koehn
Browse files

method for getting comparison-data from json-files

parent 1f51d45a
......@@ -39,6 +39,26 @@ def get_all(force=False):
return get_all()
get_all.cache = None
def get_comparison_extra_source(root_type):
for data in get_all():
if data['root-type'] == root_type:
if not 'comparison_data' in data or not data['comparison_data']:
raise NoComparisonDataError("No comparison-data was defined for this datatype")
elif not 'extra-source' in data['comparison_data'] or not data['comparison_data']['extra-source']:
raise NoComparisonDataError("No Source of additional Data was defined for this datatype")
else:
return data['comparison_data']['extra-source']
def get_comparison_identifier(root_type):
for data in get_all():
if data['root-type'] == root_type:
if not 'comparison_data' in data or not data['comparison_data']:
raise NoComparisonDataError("No comparison-data was defined for this datatype")
elif not 'identifier' in data['comparison_data'] or not data['comparison_data']['identifier']:
raise NoComparisonDataError("No Identifier for this datatype was defined")
else:
return data['comparison_data']['identifier']
def get_rest(root_type):
"""Returns REST-API-Interface of a given Root-Type, defined in its json-file.
......
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