From 31c31a3c1d6168539040aabe31631e48770c11c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Gmach?= Date: Sat, 15 Feb 2025 18:34:50 +0100 Subject: [PATCH 1/2] Fix typos --- docs/config.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/config.rst b/docs/config.rst index ee9d1b9fe..c1270df98 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -1645,14 +1645,14 @@ If you specify a substitution string like this:: {env:KEY:DEFAULTVALUE} -then the value will be retrieved as ``os.environ['KEY']`` and replace with DEFAULTVALUE if the environment variable does +then the value will be retrieved as ``os.environ['KEY']`` and replaced with DEFAULTVALUE if the environment variable does not exist. If you specify a substitution string like this:: {env:KEY:} -then the value will be retrieved as ``os.environ['KEY']`` and replace with an empty string if the environment variable +then the value will be retrieved as ``os.environ['KEY']`` and replaced with an empty string if the environment variable does not exist. Substitutions can also be nested. In that case they are expanded starting from the innermost expression:: From a47504e595568813bf9dd17ce590b0e567bd5d52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Gmach?= Date: Sat, 15 Feb 2025 18:43:50 +0100 Subject: [PATCH 2/2] Fix docs for retrieving missing environment variable. Fixes #3456 --- docs/changelog/3456.doc.rst | 1 + docs/config.rst | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 docs/changelog/3456.doc.rst diff --git a/docs/changelog/3456.doc.rst b/docs/changelog/3456.doc.rst new file mode 100644 index 000000000..1b5c9ca46 --- /dev/null +++ b/docs/changelog/3456.doc.rst @@ -0,0 +1 @@ +Updates the documentation for ``os.environ['KEY']`` when the variable does not exist - by :user:`jugmac00`. diff --git a/docs/config.rst b/docs/config.rst index c1270df98..db1c27d73 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -1635,7 +1635,8 @@ If you specify a substitution string like this:: {env:KEY} -then the value will be retrieved as ``os.environ['KEY']`` and raise an Error if the environment variable does not exist. +then the value will be retrieved as ``os.environ['KEY']`` and replaced with an empty string if the environment variable +does not exist. Environment variable substitutions with default values