mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Disallow all multiline-values
This commit is contained in:
parent
7132ccdebb
commit
9c45a7852a
2 changed files with 7 additions and 2 deletions
|
|
@ -30,7 +30,7 @@ def load_config(fname, pair_options=('collections', 'conflict_resolution')):
|
||||||
c = RawConfigParser()
|
c = RawConfigParser()
|
||||||
c.read(fname)
|
c.read(fname)
|
||||||
|
|
||||||
get_options = lambda s: dict(parse_options(c.items(s)))
|
get_options = lambda s: dict(parse_options(c.items(s), section=s))
|
||||||
|
|
||||||
pairs = {}
|
pairs = {}
|
||||||
storages = {}
|
storages = {}
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,13 @@ def split_dict(d, f):
|
||||||
return a, b
|
return a, b
|
||||||
|
|
||||||
|
|
||||||
def parse_options(items):
|
def parse_options(items, section=None):
|
||||||
for key, value in items:
|
for key, value in items:
|
||||||
|
if len(value.splitlines()) > 1:
|
||||||
|
raise ValueError('Section {!r}, option {!r}: '
|
||||||
|
'No multiline-values allowed.'
|
||||||
|
.format(section, key))
|
||||||
|
|
||||||
if value.lower() in ('yes', 'true', 'on'):
|
if value.lower() in ('yes', 'true', 'on'):
|
||||||
value = True
|
value = True
|
||||||
elif value.lower() in ('no', 'false', 'off'):
|
elif value.lower() in ('no', 'false', 'off'):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue