added more tag fields; allowed tags to be missing; added default author; cleaned up default pgroup logic
This commit is contained in:
16
e2sci.py
16
e2sci.py
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user