Skip to content
Snippets Groups Projects

add datatype, unit and description to properties that are part of Records

Merged Alexander Schlemmer requested to merge f-add-datatypes into dev
2 files
+ 37
21
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -351,25 +351,20 @@ debug : bool, optional
if prop.name in self.model:
model_prop = self.model[prop.name]
# The information must be missing, we don't want to overwrite it accidentally:
if prop.datatype is not None and prop.datatype != model_prop.datatype:
continue
# TODO: Data type overwrite is allowed here (because
# of lists), but this might change in the future.
# raise RuntimeError("datatype must not be set, here. This is probably a bug.")
if prop.unit is not None and prop.unit != model_prop.unit:
continue
if prop.description is not None and prop.description != model_prop.description:
continue
# If this property has a more detailed definition in the model,
# copy over the information:
if isinstance(model_prop, db.RecordType):
# in this case the datatype equals the name of the record type:
prop.datatype = prop.name
else:
prop.datatype = model_prop.datatype
prop.unit = model_prop.unit
if prop.datatype is None:
if isinstance(model_prop, db.RecordType):
prop.datatype = model_prop.name
else:
prop.datatype = model_prop.datatype
# TODO: Data type overwrite is allowed here (because
# of lists), but this might change in the future.
# elif prop.datatype != model_prop.datatype:
# raise RuntimeError("datatype must not be set, here. This is probably a bug.")
if prop.unit is None:
# No unit for plain reference properties
if not isinstance(model_prop, db.RecordType):
prop.unit = model_prop.unit
if prop.description is None:
prop.description = model_prop.description
return DataModel(self.model.values())
Loading