diff configmix/variables.py @ 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 13711ba8e81e
children 57ff12610dc5
line wrap: on
line diff
--- 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):