commit dc009e3071dbaa018a963fb5b0ab6076aa23cad9
parent dde120dc326862f84eba956787bd4e95b04d8406
Author: nolash <dev@holbrook.no>
Date: Sun, 31 Jan 2021 09:23:51 +0100
Avoid crash on translate bool type
Diffstat:
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/confini/config.py b/confini/config.py
@@ -168,6 +168,9 @@ class Config:
def true(self, k):
v = self.store.get(k)
+ if type(v).__name__ == 'bool':
+ logg.debug('entry {} is already bool'.format(k))
+ return v
d = self._decrypt(k, v)
if d.lower() not in ['true', 'false', '0', '1', 'on', 'off']:
raise ValueError('{} not a boolean value'.format(k))
diff --git a/test/test_env.py b/test/test_env.py
@@ -54,7 +54,6 @@ class TestEnv(unittest.TestCase):
-
def test_env_a_override(self):
os.environ['FOO_BAR'] = '43'
inidir = os.path.join(self.wd, 'files')