xep-0004 merge should deal with dictionaries
This commit is contained in:
parent
00d7952001
commit
6dfea828be
1 changed files with 4 additions and 0 deletions
|
@ -13,6 +13,7 @@ from .. xmlstream.handler.callback import Callback
|
||||||
from .. xmlstream.matcher.xpath import MatchXPath
|
from .. xmlstream.matcher.xpath import MatchXPath
|
||||||
from .. xmlstream.stanzabase import registerStanzaPlugin, ElementBase, ET, JID
|
from .. xmlstream.stanzabase import registerStanzaPlugin, ElementBase, ET, JID
|
||||||
from .. stanza.message import Message
|
from .. stanza.message import Message
|
||||||
|
import types
|
||||||
|
|
||||||
|
|
||||||
class Form(ElementBase):
|
class Form(ElementBase):
|
||||||
|
@ -199,6 +200,9 @@ class Form(ElementBase):
|
||||||
|
|
||||||
def merge(self, other):
|
def merge(self, other):
|
||||||
new = copy.copy(self)
|
new = copy.copy(self)
|
||||||
|
if type(other) == types.DictType:
|
||||||
|
new.setValues(other)
|
||||||
|
return new
|
||||||
nfields = new.getFields(use_dict=True)
|
nfields = new.getFields(use_dict=True)
|
||||||
ofields = other.getFields(use_dict=True)
|
ofields = other.getFields(use_dict=True)
|
||||||
nfields.update(ofields)
|
nfields.update(ofields)
|
||||||
|
|
Loading…
Reference in a new issue