Use startswith() instead of string slicing to check for prefixes or suffixes.

It's cleaner and less error prone, so simply use it everywhere.
This commit is contained in:
Stephan Erb 2008-04-21 20:39:55 +00:00
parent f877fbea13
commit 92b596a698
2 changed files with 2 additions and 2 deletions

View File

@ -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:]

View File

@ -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:]