diff --git a/platypush/plugins/procedures/__init__.py b/platypush/plugins/procedures/__init__.py index cffd2f65f1..0f104ed027 100644 --- a/platypush/plugins/procedures/__init__.py +++ b/platypush/plugins/procedures/__init__.py @@ -284,7 +284,7 @@ class ProceduresPlugin(RunnablePlugin, ProcedureEntityManager): return re.sub(r'[^\w.]+', '_', (name or '').strip(' .')) @classmethod - def _serialize_action(cls, data: Union[Iterable, Dict]) -> Union[Dict, List]: + def _serialize_action(cls, data: Union[Iterable, Dict]) -> Union[Dict, List, str]: if isinstance(data, dict): name = data.get('action', data.get('name')) if name: @@ -301,6 +301,8 @@ class ProceduresPlugin(RunnablePlugin, ProcedureEntityManager): ) for k, v in data.items() } + elif isinstance(data, str): + return data else: return [cls._serialize_action(item) for item in data if item is not None] diff --git a/platypush/procedure/__init__.py b/platypush/procedure/__init__.py index e2d5641496..bb5c01675e 100644 --- a/platypush/procedure/__init__.py +++ b/platypush/procedure/__init__.py @@ -281,7 +281,7 @@ class Procedure: if request.type in [StatementType.BREAK, StatementType.CONTINUE]: loop = self._find_nearest_loop(__stack__) - if request == StatementType.BREAK: + if request.type == StatementType.BREAK: loop._should_break = True # pylint: disable=protected-access else: loop._should_continue = True # pylint: disable=protected-access @@ -291,9 +291,9 @@ class Procedure: should_break = getattr(self, '_should_break', False) if isinstance(self, LoopProcedure) and (should_continue or should_break): if should_continue: - self._should_continue = ( # pylint: disable=attribute-defined-outside-init - False - ) + setattr(self, '_should_continue', False) # noqa[B010] + else: + setattr(self, '_should_break', False) # noqa[B010] break