Commits

Anonymous committed 542178a

[svn r6053] XmlRpcPlugin: Standardize all string inputs with line-ending `\r\n` to match what is received through a web client. This avoids phantom-changes to multi-line inputs on subsequent update via web.

Closes #2482.

Comments (0)

Files changed (1)

trunk/tracrpc/web_ui.py

     def _normalize_input(self, args):
         """ Normalizes arguments (at any level - traversing dicts and lists):
         1. xmlrpc.DateTime is converted to Python datetime
+        2. String line-endings same as from web (`\n` => `\r\n`)
         """
         new_args = []
         for arg in args:
             # self.env.log.debug("arg %s, type %s" % (arg, type(arg)))
             if isinstance(arg, xmlrpclib.DateTime):
                 new_args.append(from_xmlrpc_datetime(arg))
+            elif isinstance(arg, basestring):
+                new_args.append(arg.replace("\n", "\r\n"))
             elif isinstance(arg, dict):
                 for key in arg.keys():
                     arg[key] = self._normalize_input([arg[key]])[0]