summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Fritz <fritzy@netflint.net>2010-01-27 15:09:45 -0800
committerNathan Fritz <fritzy@netflint.net>2010-01-27 15:09:45 -0800
commitf159328dc436632450e09ed4a2992e7e7f9afde4 (patch)
tree59f26e2cc6c87762cedf40e41c318f79fce408b4
parenta4ec7413e4dc9246f4612b73fca9b9d842287e44 (diff)
parent3dbd496de8b6d358b657eada91acc6b71455ffbf (diff)
downloadslixmpp-f159328dc436632450e09ed4a2992e7e7f9afde4.tar.gz
slixmpp-f159328dc436632450e09ed4a2992e7e7f9afde4.tar.bz2
slixmpp-f159328dc436632450e09ed4a2992e7e7f9afde4.tar.xz
slixmpp-f159328dc436632450e09ed4a2992e7e7f9afde4.zip
Merge branch 'master' of github.com:fritzy/SleekXMPP
-rw-r--r--sleekxmpp/stanza/presence.py22
-rw-r--r--testall.py4
2 files changed, 14 insertions, 12 deletions
diff --git a/sleekxmpp/stanza/presence.py b/sleekxmpp/stanza/presence.py
index 6a8247c5..2bf767d4 100644
--- a/sleekxmpp/stanza/presence.py
+++ b/sleekxmpp/stanza/presence.py
@@ -15,18 +15,18 @@ class Presence(RootStanza):
return self.xml.find("{%s}show" % self.namespace)
def setType(self, value):
+ show = self.getShowElement()
if value in self.types:
- show = self.getShowElement()
- if value in self.types:
- if show is not None:
- self.xml.remove(show)
- if value == 'available':
- value = ''
- self._setAttr('type', value)
- elif value in self.showtypes:
- if show is None:
- show = ET.Element("{%s}show" % self.namespace)
- show.text = value
+ if show is not None:
+ self.xml.remove(show)
+ if value == 'available':
+ value = ''
+ self._setAttr('type', value)
+ elif value in self.showtypes:
+ if show is None:
+ show = ET.Element("{%s}show" % self.namespace)
+ self.xml.append(show)
+ show.text = value
return self
def setPriority(self, value):
diff --git a/testall.py b/testall.py
index 982ad642..00c463b9 100644
--- a/testall.py
+++ b/testall.py
@@ -16,6 +16,7 @@ class testoverall(unittest.TestCase):
"""Invoking the tabnanny"""
import tabnanny
self.failIf(tabnanny.check("." + os.sep + 'sleekxmpp'))
+ #raise "Help!"
def testMethodLength(self):
"""Testing for excessive method lengths"""
@@ -62,4 +63,5 @@ if __name__ == '__main__':
#sys.modules[modname].config = moduleconfig
alltests.append(sys.modules[modname].suite)
alltests_suite = unittest.TestSuite(alltests)
- unittest.TextTestRunner(verbosity=2).run(alltests_suite)
+ result = unittest.TextTestRunner(verbosity=2).run(alltests_suite)
+ print("""<tests xmlns='http://andyet.net/protocol/tests' ran='%s' errors='%s' fails='%s' success='%s' />""" % (result.testsRun, len(result.errors), len(result.failures), result.wasSuccessful()))