added more tag fields; allowed tags to be missing; added default author; cleaned up default pgroup logic

This commit is contained in:
2022-07-29 11:37:35 +02:00
parent 453320d855
commit ec24e9dd34

View File

@@ -16,6 +16,7 @@ def json_save(what, filename, *args, indent=4, sort_keys=True, **kwargs):
default_pgroup = "default"
default_author = "default"
mapped = {
@@ -43,7 +44,14 @@ special = [
tags = [
"Component",
"Entry",
"System"
"System",
"Category",
"Domain",
"Effect",
"Valid until",
"Group",
"Type"
]
@@ -70,17 +78,17 @@ for fn in fns:
data_out.update(tmp)
# make tags
tmp = [data_in.pop(t) for t in tags]
tmp = [data_in.pop(t, None) for t in tags]
tmp = [i for i in tmp if i]
if tmp:
data_out["tags"] = tmp
# treat special entries
author = data_in.pop("Author")
author = authors[author]
author = authors.get(author, default_author)
data_out["createdBy"] = author
pgroup = data_in.pop("P-Group") or default_pgroup
pgroup = data_in.pop("P-Group", default_pgroup)
data_out["ownerGroup"] = pgroup
data_out["accessGroups"] = [author, pgroup]