From 92b596a69873ed4c972841e447d9982290ced11f Mon Sep 17 00:00:00 2001 From: Stephan Erb Date: Mon, 21 Apr 2008 20:39:55 +0000 Subject: [PATCH] Use startswith() instead of string slicing to check for prefixes or suffixes. It's cleaner and less error prone, so simply use it everywhere. --- src/common/connection_handlers.py | 2 +- src/common/zeroconf/connection_handlers_zeroconf.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py index 980ea9e7a..2b59759a1 100644 --- a/src/common/connection_handlers.py +++ b/src/common/connection_handlers.py @@ -428,7 +428,7 @@ class ConnectionBytestream: if real_id == self.awaiting_xmpp_ping_id: self.awaiting_xmpp_ping_id = None return - if real_id[:3] != 'au_': + if not real_id.startswith('au_'): return frm = helpers.get_full_jid_from_iq(iq_obj) id = real_id[3:] diff --git a/src/common/zeroconf/connection_handlers_zeroconf.py b/src/common/zeroconf/connection_handlers_zeroconf.py index 848bdff9e..e83556416 100644 --- a/src/common/zeroconf/connection_handlers_zeroconf.py +++ b/src/common/zeroconf/connection_handlers_zeroconf.py @@ -454,7 +454,7 @@ class ConnectionBytestream: # if we want to respect jep-0065 we have to check for proxy # activation result in any result iq real_id = unicode(iq_obj.getAttr('id')) - if real_id[:3] != 'au_': + if not real_id.startswith('au_'): return frm = unicode(iq_obj.getFrom()) id = real_id[3:]