diff options
author | David Sommerseth <davids@redhat.com> | 2012-12-05 21:04:08 +0100 |
---|---|---|
committer | David Sommerseth <davids@redhat.com> | 2012-12-05 21:07:26 +0100 |
commit | 1f58fed0848c7cf9c48a5187d244536659b2bd92 (patch) | |
tree | 3f772e9ecb483291b7f35373cfea1e4bf25a5b9e | |
parent | 24f598369fdaf254a75ec7225de941da391576a4 (diff) | |
download | rteval-1f58fed0848c7cf9c48a5187d244536659b2bd92.tar.gz |
Make the config parser case sensitive and make it ignore comments
The config parser made all section names and key names lower case
by default. But when changing that to preserving the string case,
it also put comments into the value fields. So the second part
of the patch strips away everything from key values after the
first '#' and strips out leading and trailing spaces.
Signed-off-by: David Sommerseth <davids@redhat.com>
-rw-r--r-- | rteval/rtevalConfig.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/rteval/rtevalConfig.py b/rteval/rtevalConfig.py index d13d371..1f1c412 100644 --- a/rteval/rtevalConfig.py +++ b/rteval/rtevalConfig.py @@ -137,6 +137,7 @@ class rtevalConfig(rtevalCfgSection): self.__info("reading config file %s" % cfgfile) ini = ConfigParser.ConfigParser() + ini.optionxform = str ini.read(cfgfile) # wipe any previously read config info (other than the rteval stuff) @@ -151,7 +152,7 @@ class rtevalConfig(rtevalCfgSection): if not self.__config_data.has_key(s): self.__config_data[s] = {} for i in ini.items(s): - self.__config_data[s][i[0]] = i[1] + self.__config_data[s][i[0]] = i[1].split('#')[0].strip() # export the rteval section to member variables try: |