# HG changeset patch # User Thierry Florac # Date 1494926794 -7200 # Node ID 137705383aaf51fd34ad3d339ead1bc7ba44f400 # Parent e12e18e99a68266409f82cc7ee867c8685d87e09 Added dict update function diff -r e12e18e99a68 -r 137705383aaf 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 +# 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