From 0288f7ee1b3e18de94c33ba3b1a8677713de5d49 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Mon, 9 Jul 2018 14:51:17 +0000 Subject: [PATCH] Propagate the token in procedures and event hooks to make sure that the inner requests can be executed --- platypush/event/hook.py | 4 ++++ platypush/procedure/__init__.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/platypush/event/hook.py b/platypush/event/hook.py index d995c0105..a634e5c1b 100644 --- a/platypush/event/hook.py +++ b/platypush/event/hook.py @@ -147,12 +147,16 @@ class EventHook(object): runs the hook actions if the condition is met """ result = self.matches_event(event) + token = Config.get('token') if result.is_match: logger.info('Running hook {} triggered by an event'.format(self.name)) for action in self.actions: a = EventAction.build(action) + if token: + a.token = token + a.execute(event=event, **result.parsed_args) diff --git a/platypush/procedure/__init__.py b/platypush/procedure/__init__.py index 2967266a0..ba898cff9 100644 --- a/platypush/procedure/__init__.py +++ b/platypush/procedure/__init__.py @@ -99,8 +99,12 @@ class Procedure(object): logger.info('Executing request {}'.format(self.name)) response = Response() + token = Config.get('token') for request in self.requests: + if token: + request.token = token + context['async'] = self.async; context['n_tries'] = n_tries response = request.execute(**context)