aboutsummaryrefslogtreecommitdiffstats
path: root/pathod/language
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-07-29 19:54:44 -0700
committerMaximilian Hils <git@maximilianhils.com>2016-07-29 19:54:44 -0700
commit453436367103dd9deb693da5b5ebb18c2c2c86ce (patch)
tree4edd57812419e4d7c8f41045c43d52f27b783265 /pathod/language
parent63f64cd66086f302f53456f29f60b1e28c8ee178 (diff)
downloadmitmproxy-453436367103dd9deb693da5b5ebb18c2c2c86ce.tar.gz
mitmproxy-453436367103dd9deb693da5b5ebb18c2c2c86ce.tar.bz2
mitmproxy-453436367103dd9deb693da5b5ebb18c2c2c86ce.zip
add escape_single_quotes=False arg to bytes_to_escaped_str
Diffstat (limited to 'pathod/language')
-rw-r--r--pathod/language/base.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/pathod/language/base.py b/pathod/language/base.py
index 25f3fd1a..39155858 100644
--- a/pathod/language/base.py
+++ b/pathod/language/base.py
@@ -136,7 +136,7 @@ class TokValueLiteral(_TokValueLiteral):
def spec(self):
inner = strutils.bytes_to_escaped_str(self.val)
- inner = inner.replace(r"\'", r"\x27")
+ inner = inner.replace(r"'", r"\x27")
return "'" + inner + "'"
@@ -148,7 +148,7 @@ class TokValueNakedLiteral(_TokValueLiteral):
return e.setParseAction(lambda x: cls(*x))
def spec(self):
- return strutils.bytes_to_escaped_str(self.val)
+ return strutils.bytes_to_escaped_str(self.val, escape_single_quotes=True)
class TokValueGenerate(Token):
@@ -166,7 +166,7 @@ class TokValueGenerate(Token):
def freeze(self, settings):
g = self.get_generator(settings)
- return TokValueLiteral(strutils.bytes_to_escaped_str(g[:]))
+ return TokValueLiteral(strutils.bytes_to_escaped_str(g[:], escape_single_quotes=True))
@classmethod
def expr(cls):
@@ -578,4 +578,4 @@ class NestedMessage(Token):
def freeze(self, settings):
f = self.parsed.freeze(settings).spec()
- return self.__class__(TokValueLiteral(strutils.bytes_to_escaped_str(f.encode())))
+ return self.__class__(TokValueLiteral(strutils.bytes_to_escaped_str(f.encode(), escape_single_quotes=True)))