Commit e40d145e authored by Sriram Karra's avatar Sriram Karra

Use a more compact form for esc_str and unesc_str

parent b6f0291a
......@@ -36,9 +36,9 @@ def esc_str (x):
if not x:
return x
x = string.replace(x, '\r\n', '\\n')
x = string.replace(x, '\n', '\\n')
return string.replace(x, '"', r'\"')
x = x.replace('\r\n', '\\n')
x = x.replace('\n', '\\n')
return x.replace('"', r'\"')
def unesc_str (x):
"""This is the inverse of escape_str. i.e. this undoes any escaping
......@@ -48,8 +48,8 @@ def unesc_str (x):
if not x:
return x
x = string.replace(x, '\\n', '\n')
return string.replace(x, r'\"', '"')
x = x.replace('\\n', '\n')
return x.replace(r'\"', '"')
class BBDBParseError(Exception):
pass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment