fix min and max checks if they are not set
This commit is contained in:
parent
5e45462608
commit
303a604cf6
@ -56,6 +56,9 @@ class Oms:
|
|||||||
|
|
||||||
def get_attribute_value(self, inst : InstanceReference, att : InstanceReference, default_value = None):
|
def get_attribute_value(self, inst : InstanceReference, att : InstanceReference, default_value = None):
|
||||||
value = self.get_attribute_value_internal(inst, att, default_value)
|
value = self.get_attribute_value_internal(inst, att, default_value)
|
||||||
|
if value is None:
|
||||||
|
return default_value
|
||||||
|
|
||||||
pclass = self.get_parent_class(att)
|
pclass = self.get_parent_class(att)
|
||||||
if pclass is not None:
|
if pclass is not None:
|
||||||
if pclass.get_global_identifier() == KnownClassGuids.NumericAttribute:
|
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))
|
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))
|
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")
|
return OmsResult(False, "parameter out of range: value")
|
||||||
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user