Skip to content
Snippets Groups Projects
Commit ed6b7d57 authored by Alexander Schlemmer's avatar Alexander Schlemmer
Browse files

ENH: files can now be added in yml format

parent 3885ce60
Branches
Tags
1 merge request!53Release 0.1
...@@ -220,6 +220,11 @@ class Converter(object): ...@@ -220,6 +220,11 @@ class Converter(object):
if "records" not in self.definition: if "records" not in self.definition:
return [] return []
role = "Record"
# This allows us to create e.g. Files
if "role" in self.definition:
role = self.definition["role"]
# list of keys to identify, which variables have been set by which paths: # list of keys to identify, which variables have been set by which paths:
# these are tuples: # these are tuples:
# 0: record name # 0: record name
...@@ -230,7 +235,12 @@ class Converter(object): ...@@ -230,7 +235,12 @@ class Converter(object):
# whether the record already exists in the store or not are actually really # whether the record already exists in the store or not are actually really
# different distinct cases for treating the setting and updating of variables: # different distinct cases for treating the setting and updating of variables:
if name not in records: if name not in records:
if role == "Record":
c_record = db.Record() c_record = db.Record()
elif role == "File":
c_record = db.File()
else:
raise RuntimeError("Role {} not supported.".format(role))
# add the new record to the record store: # add the new record to the record store:
records[name] = c_record records[name] = c_record
# additionally add the new record to the general store: # additionally add the new record to the general store:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment