More string fixes
This commit is contained in:
parent
79104bc3a8
commit
63e0384de5
@ -30,18 +30,19 @@ def set(key, value):
|
||||
# See: from http://docs.python.org/library/os.html
|
||||
# Calling putenv() directly does not change os.environ, so it's better to modify os.environ.
|
||||
if key is not None:
|
||||
LOG.audit("Setting environment key [%s] to value [%s]" % (key, value))
|
||||
LOG.audit("Setting environment key %r to value %r" % (str(key), str(value)))
|
||||
os.environ[str(key)] = str(value)
|
||||
|
||||
|
||||
def get_key(key, default_value=None):
|
||||
if not key:
|
||||
return default_value
|
||||
LOG.debug("Looking up environment variable [%s]" % (key))
|
||||
key = str(key)
|
||||
LOG.debug("Looking up environment variable %r" % (key))
|
||||
value = get().get(key)
|
||||
if value is None:
|
||||
LOG.debug("Could not find anything in environment variable [%s]" % (key))
|
||||
LOG.debug("Could not find anything in environment variable %r" % (key))
|
||||
value = default_value
|
||||
else:
|
||||
LOG.audit("Found [%s] in environment variable [%s]" % (value, key))
|
||||
LOG.audit("Found %r in environment variable %r" % (value, key))
|
||||
return value
|
||||
|
@ -272,12 +272,12 @@ class RcReader(object):
|
||||
def extract(self, fn):
|
||||
extracted_vars = dict()
|
||||
contents = ''
|
||||
LOG.audit("Loading rc file [%s]" % (fn))
|
||||
LOG.audit("Loading rc file %r" % (fn))
|
||||
try:
|
||||
with open(fn, 'r') as fh:
|
||||
contents = fh.read()
|
||||
except IOError as e:
|
||||
LOG.warn("Failed extracting rc file [%s] due to [%s]" % (fn, e))
|
||||
LOG.warn("Failed extracting rc file %r due to %s" % (fn, e))
|
||||
return extracted_vars
|
||||
for line in contents.splitlines():
|
||||
if self._is_comment(line):
|
||||
|
Loading…
Reference in New Issue
Block a user