From eaaa5e2164fb1cb57b305c02aa4bd1449c1f7222 Mon Sep 17 00:00:00 2001 From: souliane Date: Wed, 22 Jul 2015 11:42:37 +0200 Subject: [PATCH] tools (config): when reading a list or dict from the config file, ignore spaces immediately following the delimiter --- src/tools/config.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tools/config.py b/src/tools/config.py index 22d67651..3ef03644 100644 --- a/src/tools/config.py +++ b/src/tools/config.py @@ -92,8 +92,8 @@ def getConfig(config, section, name, default=None): value = os.path.expanduser(value) # thx to Brian (http://stackoverflow.com/questions/186857/splitting-a-semicolon-separated-string-to-a-dictionary-in-python/186873#186873) elif name.endswith('_list'): - value = csv.reader([value], delimiter=',', quotechar='"').next() + value = csv.reader([value], delimiter=',', quotechar='"', skipinitialspace=True).next() elif name.endswith('_dict'): - value = dict(csv.reader([item], delimiter=':', quotechar='"').next() - for item in csv.reader([value], delimiter=',', quotechar='"').next()) + value = dict(csv.reader([item], delimiter=':', quotechar='"', skipinitialspace=True).next() + for item in csv.reader([value], delimiter=',', quotechar='"', skipinitialspace=True).next()) return value