diff options
author | Lance Stout <lancestout@gmail.com> | 2013-01-26 15:10:06 -0800 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2013-01-26 15:15:01 -0800 |
commit | 23f112602c35440ca7a43cfd1efb0d3e15220a02 (patch) | |
tree | db37cbc19a3a2d56b85ca9ee3ce17e5b78e6e111 /sleekxmpp/plugins/xep_0071/stanza.py | |
parent | 639a3aa8327068bdfce3ffb72fd6ac2f058fea69 (diff) | |
download | slixmpp-23f112602c35440ca7a43cfd1efb0d3e15220a02.tar.gz slixmpp-23f112602c35440ca7a43cfd1efb0d3e15220a02.tar.bz2 slixmpp-23f112602c35440ca7a43cfd1efb0d3e15220a02.tar.xz slixmpp-23f112602c35440ca7a43cfd1efb0d3e15220a02.zip |
Get tests to pass again.
Re-add old gmail_notify plugin for now.
Diffstat (limited to 'sleekxmpp/plugins/xep_0071/stanza.py')
-rw-r--r-- | sleekxmpp/plugins/xep_0071/stanza.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/sleekxmpp/plugins/xep_0071/stanza.py b/sleekxmpp/plugins/xep_0071/stanza.py index 77957541..a5cedda3 100644 --- a/sleekxmpp/plugins/xep_0071/stanza.py +++ b/sleekxmpp/plugins/xep_0071/stanza.py @@ -26,13 +26,20 @@ class XHTML_IM(ElementBase): if lang is None: lang = self.get_lang() self.del_body(lang) - content = str(content) - header = '<body xmlns="%s"' % XHTML_NS - if lang: - header = '%s xml:lang="%s"' % (header, lang) - content = '%s>%s</body>' % (header, content) - xhtml = ET.fromstring(content) - self.xml.append(xhtml) + if lang == '*': + for sublang, subcontent in content.items(): + self.set_body(subcontent, sublang) + else: + if isinstance(content, type(ET.Element('test'))): + content = ET.tostring(content) + else: + content = str(content) + header = '<body xmlns="%s"' % XHTML_NS + if lang: + header = '%s xml:lang="%s"' % (header, lang) + content = '%s>%s</body>' % (header, content) + xhtml = ET.fromstring(content) + self.xml.append(xhtml) def get_body(self, lang=None): """Return the contents of the HTML body.""" |