don't create selection comments for now, check ConfigSubsection contents for valid...
authorFelix Domke <tmbinc@elitedvb.net>
Sun, 8 Oct 2006 22:27:00 +0000 (22:27 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Sun, 8 Oct 2006 22:27:00 +0000 (22:27 +0000)
lib/python/Components/config.py

index 07186157768d97b9450cac0c67ee01a956b2e80f..75035a78b3f414d3ab746f639b5ea5d274b32adb 100644 (file)
@@ -158,7 +158,7 @@ class ConfigSelection(ConfigElement):
                self.changed()
 
        def tostring(self, val):
-               return (val, ','.join(self.choices))
+               return val
 
        def getValue(self):
                return self._value
@@ -697,6 +697,7 @@ class ConfigSubsection(object):
        def __setattr__(self, name, value):
                if name == "saved_value":
                        return self.setSavedValue(value)
+               assert isinstance(value, ConfigSubsection) or isinstance(value, ConfigElement) or isinstance(value, ConfigSubList) or isinstance(value, ConfigSubDict), "ConfigSubsections can only store ConfigSubsections, ConfigSubLists, ConfigSubDicts or ConfigElements"
                self.content.items[name] = value
                if name in self.content.stored_values:
                        #print "ok, now we have a new item,", name, "and have the following value for it:", self.content.stored_values[name]
@@ -711,6 +712,9 @@ class ConfigSubsection(object):
                for (key, val) in self.content.items.items():
                        if val.saved_value is not None:
                                res[key] = val.saved_value
+                       elif key in res:
+                               del res[key]
+                               
                return res
 
        def setSavedValue(self, values):