diff --git a/src/caosadvancedtools/models/parser.py b/src/caosadvancedtools/models/parser.py index 5e1532e03690e753b8926b87b01db4e3a89f2c4c..5b17ab4a191c4bb797c0c79d126094986e0491c4 100644 --- a/src/caosadvancedtools/models/parser.py +++ b/src/caosadvancedtools/models/parser.py @@ -316,19 +316,22 @@ class Parser(object): self.model[name].description = prop elif prop_name == "recommended_properties": - self._add_to_recordtype(name, prop, importance=db.RECOMMENDED) + self._add_to_recordtype( + name, prop, importance=db.RECOMMENDED) for n, e in prop.items(): self._treat_entity(n, e) elif prop_name == "obligatory_properties": - self._add_to_recordtype(name, prop, importance=db.OBLIGATORY) + self._add_to_recordtype( + name, prop, importance=db.OBLIGATORY) for n, e in prop.items(): self._treat_entity(n, e) elif prop_name == "suggested_properties": - self._add_to_recordtype(name, prop, importance=db.SUGGESTED) + self._add_to_recordtype( + name, prop, importance=db.SUGGESTED) for n, e in prop.items(): self._treat_entity(n, e) @@ -355,9 +358,13 @@ class Parser(object): self.treated.append(name) def _check_datatypes(self): - """ checks if datatype is valid. - datatype of properties is simply initialized with string. Here over - properties is iterated and datatype is corrected. """ + """Checks if the datatype is valid. + + Iterate over all properties in this datamodel and choose a + valid datatype from the original datatype string in the yaml + file. Raise a ValueError if no datatype can be found. + + """ for key, value in self.model.items(): if isinstance(value, db.Property): @@ -368,7 +375,8 @@ class Parser(object): try: value.datatype = db.__getattribute__(value.datatype) except AttributeError: - raise ValueError("Unknown Datatype.") + raise ValueError( + "Property {} has an unknown datatype: {}".format(value.name, value.datatype)) def _set_recordtypes(self): """ properties are defined in first iteration; set remaining as RTs """