Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog/3456.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updates the documentation for ``os.environ['KEY']`` when the variable does not exist - by :user:`jugmac00`.
7 changes: 4 additions & 3 deletions docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -1645,14 +1646,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::
Expand Down