From 93fbcad2777cb853ec9f4e7132c078e503bba2f4 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Sun, 17 Oct 2010 06:31:05 +0800 Subject: [PATCH] Fix the error on non-number priority The priority is not a number: we consider it 0 as a default --- sleekxmpp/stanza/presence.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sleekxmpp/stanza/presence.py b/sleekxmpp/stanza/presence.py index 7eb0c5b..37dfe33 100644 --- a/sleekxmpp/stanza/presence.py +++ b/sleekxmpp/stanza/presence.py @@ -129,7 +129,11 @@ class Presence(RootStanza): p = self._getSubText('priority') if not p: p = 0 - return int(p) + try: + return int(p) + except ValueError: + # The priority is not a number: we consider it 0 as a default + return 0 def getType(self): """