diff options
| author | ghost <andreas.monzner@multimedia-labs.de> | 2010-11-16 15:28:32 +0100 |
|---|---|---|
| committer | ghost <andreas.monzner@multimedia-labs.de> | 2010-11-16 15:28:32 +0100 |
| commit | 7d6ff22b6dd5b0f7b35fb35747109d70b6324d3e (patch) | |
| tree | 2cf92a22975052779b4cd6ad19f73aafd77adcad /lib/python/Components/config.py | |
| parent | bddf5dc4d95831ef714ab55e2f47b1ac114ebe01 (diff) | |
| parent | fb91533bb1d293bdb0691bfcc1d15da9268782fe (diff) | |
| download | enigma2-7d6ff22b6dd5b0f7b35fb35747109d70b6324d3e.tar.gz enigma2-7d6ff22b6dd5b0f7b35fb35747109d70b6324d3e.zip | |
Merge branch 'master' into experimental
Diffstat (limited to 'lib/python/Components/config.py')
| -rwxr-xr-x | lib/python/Components/config.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py index d7506e31..44ad6d2a 100755 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -1624,16 +1624,17 @@ class Config(ConfigSubsection): self.pickle_this("config", self.saved_value, result) return ''.join(result) - def unpickle(self, lines): + def unpickle(self, lines, base_file=True): tree = { } for l in lines: if not l or l[0] == '#': continue n = l.find('=') + name = l[:n] val = l[n+1:].strip() - names = l[:n].split('.') + names = name.split('.') # if val.find(' ') != -1: # val = val[:val.find(' ')] @@ -1644,6 +1645,12 @@ class Config(ConfigSubsection): base[names[-1]] = val + 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 + # we inherit from ConfigSubsection, so ... #object.__setattr__(self, "saved_value", tree["config"]) if "config" in tree: @@ -1655,9 +1662,9 @@ class Config(ConfigSubsection): f.write(text) f.close() - def loadFromFile(self, filename): + def loadFromFile(self, filename, base_file=False): f = open(filename, "r") - self.unpickle(f.readlines()) + self.unpickle(f.readlines(), base_file) f.close() config = Config() @@ -1668,7 +1675,7 @@ class ConfigFile: def load(self): try: - config.loadFromFile(self.CONFIG_FILE) + config.loadFromFile(self.CONFIG_FILE, True) except IOError, e: print "unable to load config (%s), assuming defaults..." % str(e) |
