From d79234196e2d24324c979a90592d51bfdfc33f2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20K=C3=A1cha?= <ph@cesnet.cz> Date: Wed, 18 Feb 2015 20:04:49 +0100 Subject: [PATCH] Allow for JavaScript "//" comments in configuration - better for syntax highlighting. :) (deja-vu) --- warden3/warden_client/warden_client.py | 2 +- warden3/warden_server/warden_server.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/warden3/warden_client/warden_client.py b/warden3/warden_client/warden_client.py index 752a9ec..9f13ab7 100644 --- a/warden3/warden_client/warden_client.py +++ b/warden3/warden_client/warden_client.py @@ -430,5 +430,5 @@ class Client(object): def read_cfg(cfgfile): abspath = path.join(path.dirname(__file__), cfgfile) with open(abspath, "r") as f: - stripcomments = "\n".join((l for l in f if not l.lstrip().startswith("#", "//"))) + stripcomments = "\n".join((l for l in f if not l.lstrip().startswith(("#", "//")))) return json.loads(stripcomments) diff --git a/warden3/warden_server/warden_server.py b/warden3/warden_server/warden_server.py index 2c38a36..cae6178 100755 --- a/warden3/warden_server/warden_server.py +++ b/warden3/warden_server/warden_server.py @@ -879,7 +879,7 @@ def read_ini(path): def read_cfg(path): with open(path, "r") as f: - stripcomments = "\n".join((l for l in f if not l.lstrip().startswith("#"))) + stripcomments = "\n".join((l for l in f if not l.lstrip().startswith(("#", "//")))) conf = json.loads(stripcomments) # Lowercase keys -- GitLab