tools (config): when reading a list or dict from the config file, ignore spaces immediately following the delimiter
This commit is contained in:
parent
7c4bed58c5
commit
eaaa5e2164
1 changed files with 3 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue