forked from platypush/platypush
If a for loop argument returns a native Python iterable then expand that iterable
This commit is contained in:
parent
3c675b296f
commit
5ca8ee594f
1 changed files with 8 additions and 1 deletions
|
@ -186,7 +186,14 @@ class LoopProcedure(Procedure):
|
||||||
self.requests = requests
|
self.requests = requests
|
||||||
|
|
||||||
def execute(self, _async=None, **context):
|
def execute(self, _async=None, **context):
|
||||||
iterable = Request.expand_value_from_context(self.iterable, **context)
|
# noinspection PyBroadException
|
||||||
|
try:
|
||||||
|
iterable = eval(self.iterable)
|
||||||
|
if not hasattr(iterable, '__iter__'):
|
||||||
|
raise RuntimeError
|
||||||
|
except:
|
||||||
|
iterable = Request.expand_value_from_context(self.iterable, **context)
|
||||||
|
|
||||||
response = Response()
|
response = Response()
|
||||||
|
|
||||||
for item in iterable:
|
for item in iterable:
|
||||||
|
|
Loading…
Reference in a new issue