diff --git a/stateengine/StateEngineActions.py b/stateengine/StateEngineActions.py index 05f2b340a..75a64de47 100755 --- a/stateengine/StateEngineActions.py +++ b/stateengine/StateEngineActions.py @@ -82,8 +82,7 @@ def update(self, attribute, value): return _count, _issue elif isinstance(value, str): value = ":".join(map(str.strip, value.split(":"))) - if value[:1] == '[' and value[-1:] == ']': - value = StateEngineTools.convert_str_to_list(value, False) + value = StateEngineTools.convert_str_to_list(value, False) if name in self.__actions: self.__actions[name].update_action_details(self.__state, self.__action_type) if func == "se_delay": @@ -388,8 +387,7 @@ def remove_action(e): entry = list("{!s}:{!s}".format(k, v) for (k, v) in entry.items())[0] key, val = StateEngineTools.partition_strip(entry, ":") val = ":".join(map(str.strip, val.split(":"))) - if val[:1] == '[' and val[-1:] == ']': - val = StateEngineTools.convert_str_to_list(val, False) + val = StateEngineTools.convert_str_to_list(val, False) if key == "function": parameter[key] = StateEngineTools.cast_str(val) elif key == "force": diff --git a/stateengine/StateEngineTools.py b/stateengine/StateEngineTools.py index 8be8bb0b2..b423c9c6a 100755 --- a/stateengine/StateEngineTools.py +++ b/stateengine/StateEngineTools.py @@ -318,9 +318,13 @@ def partition_strip(value, splitchar): # returns: list or original value def convert_str_to_list(value, force=True): if isinstance(value, str): + orig_value = value value = value.strip() if value.startswith('[') and value.endswith(']'): value = value[1:-1].strip() + else: + return orig_value + if isinstance(value, str) and "," in value: try: elements = re.findall(r"'([^']*)'|\"([^\"]*)\"|([^,]+)", value)