--- a/src/pyams_utils/dict.py Mon Jun 19 15:54:58 2017 +0200
+++ b/src/pyams_utils/dict.py Mon Jun 19 16:05:08 2017 +0200
@@ -21,6 +21,34 @@
def update_dict(input, key, value):
- """Update given mapping if input value is not null"""
+ """Update given mapping if input value is a boolean 'true' value
+
+ :param dict input: input dictionary
+ :param key: mapping key
+ :param value: new value
+
+ 'False' values leave mapping unchanged::
+
+ >>> from pyams_utils.dict import update_dict
+ >>> mydict = {}
+ >>> update_dict(mydict, 'key1', None)
+ >>> mydict
+ {}
+ >>> update_dict(mydict, 'key1', '')
+ >>> mydict
+ {}
+ >>> update_dict(mydict, 'key1', 0)
+ >>> mydict
+ {}
+
+ 'True' values modify the mapping::
+
+ >>> update_dict(mydict, 'key1', 'value')
+ >>> mydict
+ {'key1': 'value'}
+ >>> update_dict(mydict, 'key1', 'value2')
+ >>> mydict
+ {'key1': 'value2'}
+ """
if value:
input[key] = value