fix min and max checks if they are not set

This commit is contained in:
Michael Becker 2024-03-31 16:04:17 -04:00
parent 5e45462608
commit 303a604cf6

View File

@ -56,6 +56,9 @@ class Oms:
def get_attribute_value(self, inst : InstanceReference, att : InstanceReference, default_value = None):
value = self.get_attribute_value_internal(inst, att, default_value)
if value is None:
return default_value
pclass = self.get_parent_class(att)
if pclass is not None:
if pclass.get_global_identifier() == KnownClassGuids.NumericAttribute:
@ -79,7 +82,7 @@ class Oms:
max_val = self.get_attribute_value(att, self.get_instance_by_global_identifier(KnownAttributeGuids.MaximumValue))
min_val = self.get_attribute_value(att, self.get_instance_by_global_identifier(KnownAttributeGuids.MinimumValue))
if val < min_val or val > max_val:
if (min_val is not None and val < min_val) or (max_val is not None and val > max_val):
return OmsResult(False, "parameter out of range: value")
except ValueError: