fix off-by-one bug in ConfigSubList
[enigma2.git] / lib / python / Components / config.py
index 10f112c6379296d715a63ae2c30e198f4f8ea9b3..07186157768d97b9450cac0c67ee01a956b2e80f 100644 (file)
@@ -73,6 +73,16 @@ class ConfigElement(object):
        def addNotifier(self, notifier):
                assert callable(notifier), "notifiers must be callable"
                self.notifiers.append(notifier)
+               
+               # CHECKME:
+               # do we want to call the notifier
+               #  - at all when adding it? (yes)
+               #  - when the default is active? (yes)
+               #  - when no value *yet* has been set,
+               #    because no config has ever been read (currently yes)
+               #    (though that's not so easy to detect.
+               #     the entry could just be new.)
+               notifier(self)
 
        def disableSave(self):
                self.save_disabled = True
@@ -621,8 +631,8 @@ class ConfigSubList(list, object):
        saved_value = property(getSavedValue, setSavedValue)
        
        def append(self, item):
-               list.append(self, item)
                i = str(len(self))
+               list.append(self, item)
                if i in self.stored_values:
                        item.saved_value = self.stored_values[i]
                        item.load()