only append to documentKeys after adding defaults

This commit is contained in:
j 2018-06-14 19:27:40 +02:00
parent 5aed135906
commit 91e0f588e5

View file

@ -95,15 +95,6 @@ def load_config(init=False):
for key in config['itemKeys']:
config['keys'][key['id']] = key
# add entities if needed
if len(config.get('entities', [])) and not [k for k in config['documentKeys'] if k['id'] == 'entites']:
config['documentKeys'].append({
'id': 'entity',
'title': 'Entity',
'type': 'string',
'find': True
})
# add missing defaults
for section in sorted((
'capabilities', 'cantPlay',
@ -140,6 +131,15 @@ def load_config(init=False):
sys.stderr.write("adding default %s:\n\t" % section)
sys.stderr.write("\n\t".join(added) + '\n\n')
# add entities if needed
if len(config.get('entities', [])) and not [k for k in config['documentKeys'] if k['id'] == 'entites']:
config['documentKeys'].append({
'id': 'entity',
'title': 'Entity',
'type': 'string',
'find': True
})
key = 'documentRightsLevel'
if key not in config:
config[key] = {}