summaryrefslogtreecommitdiff
path: root/slixmpp/xmlstream/stanzabase.py
diff options
context:
space:
mode:
Diffstat (limited to 'slixmpp/xmlstream/stanzabase.py')
-rw-r--r--slixmpp/xmlstream/stanzabase.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/slixmpp/xmlstream/stanzabase.py b/slixmpp/xmlstream/stanzabase.py
index 3e45f613..f45e4b96 100644
--- a/slixmpp/xmlstream/stanzabase.py
+++ b/slixmpp/xmlstream/stanzabase.py
@@ -17,7 +17,7 @@ from __future__ import with_statement, unicode_literals
import copy
import logging
import weakref
-from xml.etree import cElementTree as ET
+from xml.etree import ElementTree as ET
from slixmpp.xmlstream import JID
from slixmpp.xmlstream.tostring import tostring
@@ -203,7 +203,7 @@ class ElementBase(object):
"""
The core of Slixmpp's stanza XML manipulation and handling is provided
- by ElementBase. ElementBase wraps XML cElementTree objects and enables
+ by ElementBase. ElementBase wraps XML ElementTree objects and enables
access to the XML contents through dictionary syntax, similar in style
to the Ruby XMPP library Blather's stanza implementation.
@@ -387,7 +387,7 @@ class ElementBase(object):
self._index = 0
#: The underlying XML object for the stanza. It is a standard
- #: :class:`xml.etree.cElementTree` object.
+ #: :class:`xml.etree.ElementTree` object.
self.xml = xml
#: An ordered dictionary of plugin stanzas, mapped by their
@@ -1031,14 +1031,19 @@ class ElementBase(object):
if not lang:
lang = default_lang
+ parent = self.xml
for level, _ in enumerate(path):
# Generate the paths to the target elements and their parent.
element_path = "/".join(path[:len(path) - level])
parent_path = "/".join(path[:len(path) - level - 1])
elements = self.xml.findall(element_path)
- parent = self.xml.find(parent_path)
-
+
+ if parent_path == '':
+ parent_path = None
+ if parent_path is not None:
+ parent = self.xml.find(parent_path)
+
if elements:
if parent is None:
parent = self.xml