xep-0004 merge should deal with dictionaries

This commit is contained in:
fritzy 2010-08-31 14:44:24 +00:00
parent 00d7952001
commit 6dfea828be

View file

@ -13,6 +13,7 @@ from .. xmlstream.handler.callback import Callback
from .. xmlstream.matcher.xpath import MatchXPath
from .. xmlstream.stanzabase import registerStanzaPlugin, ElementBase, ET, JID
from .. stanza.message import Message
import types
class Form(ElementBase):
@ -199,6 +200,9 @@ class Form(ElementBase):
def merge(self, other):
new = copy.copy(self)
if type(other) == types.DictType:
new.setValues(other)
return new
nfields = new.getFields(use_dict=True)
ofields = other.getFields(use_dict=True)
nfields.update(ofields)