If the value is a platypush Message, then converting it into a string would result in a JSON dumps that might break the interpreter (e.g. 'null' is a valid JSON keyword but it's not recognized by Python). Therefore first parse the variable from JSON

This commit is contained in:
Fabio Manganiello 2018-06-06 18:50:09 +02:00
parent 850a4f2146
commit c867a21104

View file

@ -101,6 +101,8 @@ class Request(Message):
@classmethod @classmethod
def expand_value_from_context(cls, value, **context): def expand_value_from_context(cls, value, **context):
for (k, v) in context.items(): for (k, v) in context.items():
if isinstance(v, Message):
v = json.loads(str(v))
exec('{}={}'.format(k, v)) exec('{}={}'.format(k, v))
parsed_value = '' parsed_value = ''