Added dict update function
authorThierry Florac <thierry.florac@onf.fr>
Tue, 16 May 2017 11:26:34 +0200
changeset 80 137705383aaf
parent 79 e12e18e99a68
child 81 7dd11f00b114
Added dict update function
src/pyams_utils/dict.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_utils/dict.py	Tue May 16 11:26:34 2017 +0200
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+
+__docformat__ = 'restructuredtext'
+
+
+# import standard library
+
+# import interfaces
+
+# import packages
+
+
+def update_dict(input, key, value):
+    """Update given mapping if input value is not null"""
+    if value:
+        input[key] = value