Be a bit more robust with string assignment in procedure context

This commit is contained in:
Fabio Manganiello 2018-06-14 19:02:01 +02:00
parent d9b51c94c0
commit 37f952fc41

View file

@ -214,7 +214,11 @@ class IfProcedure(Procedure):
def execute(self, **context): def execute(self, **context):
for (k, v) in context.items(): for (k, v) in context.items():
try:
exec('{}={}'.format(k, v)) exec('{}={}'.format(k, v))
except:
if isinstance(v, str):
exec('{}="{}"'.format(k, re.sub('(^|[^\\\])"', '\1\\"', v)))
condition_true = eval(self.condition) condition_true = eval(self.condition)
response = Response() response = Response()