From: Salvatore Orlando Date: Fri, 17 Jan 2014 16:48:44 +0000 (-0800) Subject: Sync with commit-id: 9d529dd324d234d7aeaa3e6b4d3ab961f177e2ed X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=57b3b2997c9bda2a7293b7b19d6dcaad36908f26;p=openstack-build%2Fneutron-build.git Sync with commit-id: 9d529dd324d234d7aeaa3e6b4d3ab961f177e2ed (Pulling from the gate, neutron fail rates are currently too high to have neutron jobs in the queue.) Related-Bug: #1270212 Change-Id: I94965b395cfb34ed1576b84f21aa48edf991d629 --- diff --git a/neutron/openstack/common/gettextutils.py b/neutron/openstack/common/gettextutils.py index b060c417d..618d8fbc5 100644 --- a/neutron/openstack/common/gettextutils.py +++ b/neutron/openstack/common/gettextutils.py @@ -193,10 +193,11 @@ class Message(six.text_type): # When we mod a Message we want the actual operation to be performed # by the parent class (i.e. unicode()), the only thing we do here is # save the original msgid and the parameters in case of a translation - unicode_mod = super(Message, self).__mod__(other) + params = self._sanitize_mod_params(other) + unicode_mod = super(Message, self).__mod__(params) modded = Message(self.msgid, msgtext=unicode_mod, - params=self._sanitize_mod_params(other), + params=params, domain=self.domain) return modded @@ -235,8 +236,17 @@ class Message(six.text_type): params = self._copy_param(dict_param) else: params = {} + # Save our existing parameters as defaults to protect + # ourselves from losing values if we are called through an + # (erroneous) chain that builds a valid Message with + # arguments, and then does something like "msg % kwds" + # where kwds is an empty dictionary. + src = {} + if isinstance(self.params, dict): + src.update(self.params) + src.update(dict_param) for key in keys: - params[key] = self._copy_param(dict_param[key]) + params[key] = self._copy_param(src[key]) return params