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
1 changed files with 5 additions and 1 deletions

View File

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