From ba0d699d831975eb4c0f9e5e441bba2972f91806 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Wed, 12 Jan 2011 08:55:33 -0500 Subject: Fix ordering error in Iq._set_stanza_values. If iq['query'] was set before a plugin that used the query element was set, then the query element was duplicated. --- sleekxmpp/stanza/iq.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'sleekxmpp/stanza/iq.py') diff --git a/sleekxmpp/stanza/iq.py b/sleekxmpp/stanza/iq.py index 906e6648..6388346c 100644 --- a/sleekxmpp/stanza/iq.py +++ b/sleekxmpp/stanza/iq.py @@ -199,3 +199,29 @@ class Iq(RootStanza): return waitfor.wait(timeout) else: return StanzaBase.send(self) + + def _set_stanza_values(self, values): + """ + Set multiple stanza interface values using a dictionary. + + Stanza plugin values may be set usind nested dictionaries. + + If the interface 'query' is given, then it will be set + last to avoid duplication of the element. + + Overrides ElementBase._set_stanza_values. + + Arguments: + values -- A dictionary mapping stanza interface with values. + Plugin interfaces may accept a nested dictionary that + will be used recursively. + """ + query = values.get('query', '') + if query: + del values['query'] + StanzaBase._set_stanza_values(self, values) + self['query'] = query + else: + StanzaBase._set_stanza_values(self, values) + return self + -- cgit v1.2.3