Commit 7f5e15eb authored by Franziska Koehn's avatar Franziska Koehn
Browse files

functions for getting search-types and their fields from json files

parent 23ef071b
......@@ -48,12 +48,23 @@ def get_data_types():
DIR = 'datatypes/'
files = [ f for f in listdir(DIR) if isfile(join(DIR,f)) ]
result = []
for file in files:
with open(join(DIR,file)) as f:
try:
yield json.loads(f.read())['root-type']
data=json.loads(f.read())['root-type']
result.append(data)
except ValueError:
yield None
pass
return result
def get_field_labels_of_type(type):
result = []
fields = get_fields_of_type(type)
if fields is not None:
for f in fields:
result.append(f['label'])
return result
def get_fields_of_type(type):
from os import listdir
......
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