diff options
Diffstat (limited to 'geo-replication/syncdaemon/syncdutils.py')
| -rw-r--r-- | geo-replication/syncdaemon/syncdutils.py | 15 | 
1 files changed, 15 insertions, 0 deletions
diff --git a/geo-replication/syncdaemon/syncdutils.py b/geo-replication/syncdaemon/syncdutils.py index b5f09459c57..43b21668a46 100644 --- a/geo-replication/syncdaemon/syncdutils.py +++ b/geo-replication/syncdaemon/syncdutils.py @@ -70,6 +70,9 @@ CHANGELOG_AGENT_SERVER_VERSION = 1.0  CHANGELOG_AGENT_CLIENT_VERSION = 1.0  NodeID = None  rsync_version = None +SPACE_ESCAPE_CHAR = "%20" +NEWLINE_ESCAPE_CHAR = "%0A" +PERCENTAGE_ESCAPE_CHAR = "%25"  def escape(s): @@ -83,6 +86,18 @@ def unescape(s):      return urllib.unquote_plus(s) +def escape_space_newline(s): +    return s.replace("%", PERCENTAGE_ESCAPE_CHAR)\ +            .replace(" ", SPACE_ESCAPE_CHAR)\ +            .replace("\n", NEWLINE_ESCAPE_CHAR) + + +def unescape_space_newline(s): +    return s.replace(SPACE_ESCAPE_CHAR, " ")\ +            .replace(NEWLINE_ESCAPE_CHAR, "\n")\ +            .replace(PERCENTAGE_ESCAPE_CHAR, "%") + +  def norm(s):      if s:          return s.replace('-', '_')  | 
