From 1ad171dfe54238f4235de67d7fc3c7eb1d8ec3c0 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Wed, 20 Jun 2012 23:19:52 -0700 Subject: [PATCH] Fix issue with setting subelements values with default langs. --- sleekxmpp/xmlstream/stanzabase.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sleekxmpp/xmlstream/stanzabase.py b/sleekxmpp/xmlstream/stanzabase.py index 64e00626..88276ddf 100644 --- a/sleekxmpp/xmlstream/stanzabase.py +++ b/sleekxmpp/xmlstream/stanzabase.py @@ -1003,11 +1003,11 @@ class ElementBase(object): last_xml = element element = last_xml - if element.attrib.get('{%s}lang' % XML_NS, default_lang) != lang: - element = ET.Element(ename) - if lang: + if lang: + if element.attrib.get('{%s}lang' % XML_NS, default_lang) != lang: + element = ET.Element(ename) element.attrib['{%s}lang' % XML_NS] = lang - parent.append(element) + parent.append(element) element.text = text return element