* added first stanza tests

* added stanza.keys()
* stanza.getValues() now return substanzas and plugins
* stanza.setValues() now can read substanzas and plugins
* stanzas can now be iterable if stanza.subitem is set to a class
This commit is contained in:
Nathan Fritz
2010-01-08 01:45:11 +00:00
parent b54221f2a9
commit 8e3168e145
4 changed files with 161 additions and 66 deletions

View File

@@ -48,14 +48,14 @@ class Iq(RootStanza):
def setQuery(self, value):
query = self.xml.find("{%s}query" % value)
if query is None:
if query is None and value:
self.clear()
query = ET.Element("{%s}query" % value)
self.xml.append(query)
return self
def getQuery(self):
for child in self.getchildren():
for child in self.xml.getchildren():
if child.tag.endswith('query'):
ns =child.tag.split('}')[0]
if '{' in ns: