diff options
-rw-r--r-- | src/java_config_2/FileParser.py | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/src/java_config_2/FileParser.py b/src/java_config_2/FileParser.py index a7a70f4..bf8a60e 100644 --- a/src/java_config_2/FileParser.py +++ b/src/java_config_2/FileParser.py @@ -23,26 +23,25 @@ class FileParser: line = line.strip('\n') if line.isspace() or line == '' or line.startswith('#'): continue - else: - index = line.find('=') - name = line[:index] - value = line [index+1:] - - if value == '': - continue - #raise InvalidConfigError(file) - - value = value.strip('\\\'\"') - - while value.find('${') >= 0: - item = value[value.find('${')+2:value.find('}')] - - if item in self.config: - val = self.config[item] - else: - val = '' - value = value.replace('${%s}' % item, val) - self.pair(name,value) + + index = line.find('=') + name = line[:index] + value = line[index+1:] + + if value == '': + continue + + value = value.strip('\\\'\"') + + while value.find('${') >= 0: + item = value[value.find('${')+2:value.find('}')] + + if item in self.config: + val = self.config[item] + else: + val = '' + value = value.replace('${%s}' % item, val) + self.pair(name,value) def pair(self, key, value): pass |