lib/python/Components/config.py: more robust code
authorghost <andreas.monzner@multimedia-labs.de>
Mon, 22 Nov 2010 11:43:30 +0000 (12:43 +0100)
committerghost <andreas.monzner@multimedia-labs.de>
Mon, 22 Nov 2010 11:43:30 +0000 (12:43 +0100)
#refs #617

lib/python/Components/config.py

index 44ad6d2..6e56085 100755 (executable)
@@ -1647,9 +1647,12 @@ class Config(ConfigSubsection):
 
                        if not base_file: # not the initial config file..
                                #update config.x.y.value when exist
-                               configEntry = eval(name)
-                               if configEntry is not None:
-                                       configEntry.value = val
+                               try:
+                                       configEntry = eval(name)
+                                       if configEntry is not None:
+                                               configEntry.value = val
+                               except (SyntaxError, KeyError):
+                                       pass
 
                # we inherit from ConfigSubsection, so ...
                #object.__setattr__(self, "saved_value", tree["config"])