confini

Parse and merge multiple ini files in python3
git clone git://git.defalsify.org/python-confini.git
Log | Files | Refs | README | LICENSE

commit 6e62499dd19d741cfdf7743921dcb42f7777b685
parent 0f894ed3a3ad2800ae51ebda29a4bfd040bc9de5
Author: nolash <dev@holbrook.no>
Date:   Tue, 20 Oct 2020 06:16:35 +0200

Add optional default value arg to get

Diffstat:
MCHANGELOG | 8++++++--
Mconfini/config.py | 6+++++-
Msetup.py | 3+--
3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG @@ -1,7 +1,11 @@ -0.2.3 +0.2.5 + - Add default value as second argument to get +0.2.4 - Published on pypi.org +0.2.3 + - (skipped) 0.2.2 - - (Skipped) + - (skipped) 0.2.1 - Set logger name - Omit empty string environment variables diff --git a/confini/config.py b/confini/config.py @@ -137,8 +137,12 @@ class Config: return v - def get(self, k): + def get(self, k, default=None): v = self.store.get(k) + if v == None: + if default != None: + logg.debug('returning default value for {}'.format(k)) + return default return self._decrypt(k, v) diff --git a/setup.py b/setup.py @@ -6,8 +6,7 @@ f.close() setup( name='confini', - #version='0.2.1', - version='0.2.3', + version='0.2.5', description='Parse, verify and merge all ini files in a single directory', author='Louis Holbrook', author_email='dev@holbrook.no',