From 722b164d56a7979ce4da81f54378942fb16f38d5 Mon Sep 17 00:00:00 2001 From: Salvo 'LtWorf' Tomaselli Date: Sat, 23 Apr 2016 15:19:32 +0200 Subject: [PATCH] Fix Python code generator to correctly escape strings A string that contained escape symbols was not correctly escaped when generating the Python code for the selection. This could cause selection operations to fail to compile. --- CHANGELOG | 1 + relational/parser.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 8c3decc..95a2a28 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ - Changes to make failures in commutative operators commutative too - Added new optimization to remove useless joins - Correct optimization over selection and product +- Fix Python code generator to correctly escape strings 2.4 - Improve error reporting diff --git a/relational/parser.py b/relational/parser.py index 187cb8d..c852cfb 100644 --- a/relational/parser.py +++ b/relational/parser.py @@ -194,7 +194,7 @@ class Node (object): prop = '{\"%s\"}' % prop.replace( ',', '\",\"').replace(ARROW, '\":\"').replace(' ', '') else: # Selection - prop = '\"%s\"' % prop + prop = repr(prop) return '%s.%s(%s)' % (self.child.toPython(), op_functions[self.name], prop) return self.name