changeset 353:a7491f835cb0

Changelog and minimal docu for `None` and `Empty` filters
author Franz Glasner <f.glasner@feldmann-mg.com>
date Thu, 24 Jun 2021 19:39:20 +0200
parents 2b209bdf6995
children bd28fb4565e1
files CHANGES.txt docs/introduction.rst
diffstat 2 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Thu Jun 24 19:26:53 2021 +0200
+++ b/CHANGES.txt	Thu Jun 24 19:39:20 2021 +0200
@@ -18,6 +18,12 @@
 - **[feature]**
   New filter function :py:func:`urlquote_plus`
 
+- **[feature]**
+  New filter functions :py:func:`None` and :py:func:`Empty`. They are
+  useful in variable interpolation context where they suppress possible
+  lookup errors (aka :py:exception:`KeyError`) and instead return with
+  :py:obj:`None` or an empty string.
+
 
 0.14 (2021-05-10)
 ~~~~~~~~~~~~~~~~~
--- a/docs/introduction.rst	Thu Jun 24 19:26:53 2021 +0200
+++ b/docs/introduction.rst	Thu Jun 24 19:39:20 2021 +0200
@@ -417,6 +417,11 @@
 
   ``upper``
 
+Also available are special filter functions ``None`` and ``Empty``.
+They are useful in variable interpolation context because they
+suppress possible lookup errors (aka :py:exception:`KeyError`) and
+instead return with :py:obj:`None` or an empty string.
+
 
 Examples
 ~~~~~~~~
@@ -453,13 +458,13 @@
 
 With ``{{ref:#my.other.key}}``
 
-- think of it as a sort of a symbolic link to other parts of the 
+- think of it as a sort of a symbolic link to other parts of the
   configuration tree
 - by employing the special namespace ``ref``
 - can not be quoted currently in variable interpolation syntax
 - No special handling when merging is done -- merging is agnostic of
   tree references
-- Keys within :meth:`.Configuration.getvar_s`, 
+- Keys within :meth:`.Configuration.getvar_s`,
   :py:meth:`.Configuration.getvar`, :py:meth:`.Configuration.getvarl`
   and :py:meth:`.Configuration.getvarl_s`  are handled
 - in :py:meth:`.Configuration.getvar` only, when it is the directly