Mercurial > hgrepos > Python > libs > ConfigMix
changeset 242:bfa4d125fd14
FIX: The namespace lookup implementation for the "OS" namespace did not properly handle the "default" argument.
It has been ignored entirely.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 21 May 2020 08:19:03 +0200 |
| parents | f3c3bfc2bcbe |
| children | 57ff12610dc5 |
| files | CHANGES.txt configmix/variables.py |
| diffstat | 2 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES.txt Wed May 13 09:45:13 2020 +0200 +++ b/CHANGES.txt Thu May 21 08:19:03 2020 +0200 @@ -13,6 +13,17 @@ -------------- .. changelog:: + :version: n/a + :released: n/a + + .. change:: + :tags: bugfix + + The ``OS`` namespace lookup did not handle non-existing variables + properly and ignored the `default` parameter. + + +.. changelog:: :version: 0.7.3 :released: 2020-05-13
--- a/configmix/variables.py Wed May 13 09:45:13 2020 +0200 +++ b/configmix/variables.py Thu May 21 08:19:03 2020 +0200 @@ -36,7 +36,11 @@ """Lookup some process and/or OS state """ if name == "cwd": return native_os_str_to_text(os.getcwd()) - raise KeyError("key %r not found in the namespace" % name) + else: + if default is _MARKER: + raise KeyError("key %r not found in the namespace" % name) + else: + return default def _pylookup(name, default=_MARKER):
