list is Multi now which enables us to implement item access
This commit is contained in:
parent
ce56100602
commit
05f5b0ccbc
11
option.py
11
option.py
|
@ -46,15 +46,22 @@ class Multi(list):
|
||||||
return self.child.default_multi
|
return self.child.default_multi
|
||||||
|
|
||||||
def __setitem__(self, key, value):
|
def __setitem__(self, key, value):
|
||||||
|
if value is None:
|
||||||
|
owner = 'default'
|
||||||
|
else:
|
||||||
|
owner = default_owner
|
||||||
|
self.child.setowner(self.config, owner)
|
||||||
if value != None and not self.child._validate(value):
|
if value != None and not self.child._validate(value):
|
||||||
raise ConfigError("invalid value {0} "
|
raise ConfigError("invalid value {0} "
|
||||||
"for option {1}".format(str(value), self.child._name))
|
"for option {1}".format(str(value), self.child._name))
|
||||||
# FIXME : and if value is None ???
|
# FIXME : and if value is None ???
|
||||||
return super(Multi, self).__setitem__(key, value)
|
return super(Multi, self).__setitem__(key, value)
|
||||||
|
|
||||||
def append(self, value, owner=default_owner):
|
def append(self, value):
|
||||||
if owner is None:
|
if value is None:
|
||||||
owner = 'default'
|
owner = 'default'
|
||||||
|
else:
|
||||||
|
owner = default_owner
|
||||||
self.child.setowner(self.config, owner)
|
self.child.setowner(self.config, owner)
|
||||||
# changer dans la config la valeur par défaut et le owner
|
# changer dans la config la valeur par défaut et le owner
|
||||||
if value != None and not self.child._validate(value):
|
if value != None and not self.child._validate(value):
|
||||||
|
|
Loading…
Reference in New Issue