Skip to content
Snippets Groups Projects
Commit c32b5899 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

FIX: allow empty records in cfood

parent 5b7a0dfe
Branches
Tags
2 merge requests!160STY: styling,!132Allow empty records
Pipeline #40982 passed with warnings
...@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed ### ### Removed ###
### Fixed ### ### Fixed ###
- Empty Records can now be created (https://gitlab.com/caosdb/caosdb-crawler/-/issues/27)
### Security ### ### Security ###
......
...@@ -235,6 +235,12 @@ def create_records(values: GeneralStore, records: RecordStore, def_records: dict ...@@ -235,6 +235,12 @@ def create_records(values: GeneralStore, records: RecordStore, def_records: dict
keys_modified = [] keys_modified = []
for name, record in def_records.items(): for name, record in def_records.items():
# If only a name was given (Like this:
# Experiment:
# ) set record to an empty dict / empty configuration
if record is None:
record = {}
role = "Record" role = "Record"
# This allows us to create e.g. Files # This allows us to create e.g. Files
if "role" in record: if "role" in record:
......
...@@ -10,7 +10,6 @@ data: ...@@ -10,7 +10,6 @@ data:
match_name: '.*' match_name: '.*'
records: records:
Experiment: Experiment:
name: "e"
Projekt: Projekt:
parents: ["project"] parents: ["project"]
name: "p" name: "p"
...@@ -25,6 +24,7 @@ data: ...@@ -25,6 +24,7 @@ data:
records: records:
Experiment: Experiment:
parents: ["Exp"] parents: ["Exp"]
name: "e"
Projekt: Projekt:
parents: ["Projekt"] parents: ["Projekt"]
Campaign: Campaign:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment