Skip to content

Commit

Permalink
Merge pull request #20 from percival-detector/dev
Browse files Browse the repository at this point in the history
Updated parsing of true/false values for ini file download flags with…
  • Loading branch information
ajgdls committed Aug 7, 2017
2 parents a73ff03 + 008fec3 commit b42bc2c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions percival/carrier/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,17 +481,17 @@ def get_ini_file(self, item):
return value

def get_ini_file_download(self, item):
value = False
if "Configuration" not in self.conf.sections():
raise_with_traceback(RuntimeError("Configuration section not found in ini file %s" % str(self._ini_filename)))
value = self.conf.get("Configuration", item).strip("\"")
self.log.debug("Checking for %s in percival control config file. Raw value: %s", item, value)
if isinstance(value, str):
if 'false' in value.lower():
value = False
elif 'true' in value.lower():
value = True
raw_value = self.conf.get("Configuration", item).strip("\"")
self.log.debug("Checking for %s in percival control config file. Raw value: %s", item, raw_value)
if 'false' in str(raw_value).lower():
value = False
elif 'true' in str(raw_value).lower():
value = True
else:
value = bool(value)
self.log.error("Could not parse %s in percival control config file. Raw value: %s", item, raw_value)

self.log.debug(" Processed value: %s", value)
return value
Expand Down

0 comments on commit b42bc2c

Please sign in to comment.