From 9311c662007a4fdfb1a11c88498cb95ec89b81b3 Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 1 Apr 2024 15:53:30 -0400 Subject: [PATCH] Adding ListProperty leniency --- stix2/properties.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stix2/properties.py b/stix2/properties.py index da6c2f79..ff500f0f 100644 --- a/stix2/properties.py +++ b/stix2/properties.py @@ -226,7 +226,7 @@ def __init__(self, contained, **kwargs): super(ListProperty, self).__init__(**kwargs) - def clean(self, value, allow_custom): + def clean(self, value, allow_custom, strict_flag=False): try: iter(value) except TypeError: @@ -240,7 +240,7 @@ def clean(self, value, allow_custom): if isinstance(self.contained, Property): for item in value: try: - valid, temp_custom = self.contained.clean(item, allow_custom, strict=True) + valid, temp_custom = self.contained.clean(item, allow_custom, strict=strict_flag) except TypeError: valid, temp_custom = self.contained.clean(item, allow_custom) result.append(valid) @@ -451,7 +451,7 @@ def clean(self, value, allow_custom=False): clean = False for type_ in self.valid_types: if isinstance(type_, ListProperty): - type_.clean(value=dictified[k], allow_custom=False) + type_.clean(value=dictified[k], allow_custom=False, strict_flag=True) clean = True else: type_instance = type_()