Repository: qpid-dispatch Updated Branches: refs/heads/master d5d9b6845 -> 159444b28
NO-JIRA - Preserve newlines in .config file Concatenating results in awful error messages for syntactic errors in config. Error is always reported on line 1. Substitutions do not add or remove lines, therefore with this patch, line number now is meaningful. The original pull request $ git pull https://github.com/jdanekrh/qpid-dispatch newlines was extended to apply to .json files also. This closes #66 Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/159444b2 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/159444b2 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/159444b2 Branch: refs/heads/master Commit: 159444b288958f9b378d70192bf172b38a8aebb9 Parents: d5d9b68 Author: Chuck Rolke <[email protected]> Authored: Wed Apr 27 08:40:44 2016 -0400 Committer: Chuck Rolke <[email protected]> Committed: Wed Apr 27 08:40:44 2016 -0400 ---------------------------------------------------------------------- python/qpid_dispatch_internal/management/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/159444b2/python/qpid_dispatch_internal/management/config.py ---------------------------------------------------------------------- diff --git a/python/qpid_dispatch_internal/management/config.py b/python/qpid_dispatch_internal/management/config.py index d742960..3361821 100644 --- a/python/qpid_dispatch_internal/management/config.py +++ b/python/qpid_dispatch_internal/management/config.py @@ -59,7 +59,7 @@ class Config(object): line = re.sub(attr, r'"\1": "\2",', line) return line - js_text = "[%s]"%("".join([sub(l) for l in lines])) + js_text = "[%s]"%("\n".join([sub(l) for l in lines])) spare_comma = re.compile(r',\s*([]}])') # Strip spare commas js_text = re.sub(spare_comma, r'\1', js_text) # Convert dictionary keys to camelCase @@ -79,7 +79,7 @@ class Config(object): """Do substitutions to make line json-friendly""" line = line.split('#')[0].strip() # Strip comments return line - js_text = "%s"%("".join([sub(l) for l in lines])) + js_text = "%s"%("\n".join([sub(l) for l in lines])) sections = json.loads(js_text) return sections --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
