Mercurial > libervia-backend
changeset 1445:ddc7a39ff9d1
tools (config): when reading a list or dict from the config file, ignore spaces immediately following the delimiter
author | souliane <souliane@mailoo.org> |
---|---|
date | Wed, 22 Jul 2015 11:42:37 +0200 |
parents | 8ce9924fa92c |
children | e8c8e467964b |
files | src/tools/config.py |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/tools/config.py Tue Jul 21 15:36:40 2015 +0200 +++ b/src/tools/config.py Wed Jul 22 11:42:37 2015 +0200 @@ -92,8 +92,8 @@ 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