Mercurial > hgrepos > Python > libs > ConfigMix
diff configmix/variables.py @ 352:2b209bdf6995
Implement the "Empty" filter.
This is like the "None" filter but returning an empty string instead of None.
| author | Franz Glasner <f.glasner@feldmann-mg.com> |
|---|---|
| date | Thu, 24 Jun 2021 19:26:53 +0200 |
| parents | 83f76a41cf7c |
| children | dd454e1efea4 |
line wrap: on
line diff
--- a/configmix/variables.py Thu Jun 24 19:23:06 2021 +0200 +++ b/configmix/variables.py Thu Jun 24 19:26:53 2021 +0200 @@ -255,6 +255,17 @@ return v +@filter("Empty") +def Empty_filter_impl(config, v): + """Identity. + + The `Empty` filter is just a marker to not throw `KeyError` but return + the empty string. + + """ + return v + + # Register the default namespaces add_varns("ENV", _envlookup) add_varns("OS", _oslookup)
