From 05f5b0ccbc2d3595ae63a084226ca89f999ab4e6 Mon Sep 17 00:00:00 2001 From: gwen Date: Thu, 12 Jul 2012 11:56:26 +0200 Subject: [PATCH] list is Multi now which enables us to implement item access --- option.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/option.py b/option.py index 7e7fc16..d32101d 100644 --- a/option.py +++ b/option.py @@ -46,15 +46,22 @@ class Multi(list): return self.child.default_multi 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): raise ConfigError("invalid value {0} " "for option {1}".format(str(value), self.child._name)) # FIXME : and if value is None ??? return super(Multi, self).__setitem__(key, value) - def append(self, value, owner=default_owner): - if owner is None: + def append(self, value): + if value is None: owner = 'default' + else: + owner = default_owner self.child.setowner(self.config, owner) # changer dans la config la valeur par défaut et le owner if value != None and not self.child._validate(value):