Fix Python3 issue with dict.has_key()

This commit is contained in:
Lance Stout 2011-08-04 22:34:34 -07:00
parent 940e3eba35
commit 93a4a3f8a0
3 changed files with 20 additions and 19 deletions

View file

@ -463,7 +463,7 @@ class RemoteSession(object):
key = "%s.%s" % (endpoint, name)
log.debug("Registering call handler for %s (%s)." % (key, method))
with self._lock:
if self._entries.has_key(key):
if key in self._entries:
raise KeyError("A handler for %s has already been regisered!" % endpoint)
self._entries[key] = JabberRPCEntry(endpoint, method)
return key

View file

@ -144,7 +144,7 @@ except:
if offsetmins == 0:
return UTC
if not _fixed_offset_tzs.has_key(offsetmins):
if not offsetmins in _fixed_offset_tzs:
if offsetmins < 0:
sign = '-'
absoff = -offsetmins

View file

@ -854,9 +854,10 @@ class XMLStream(object):
Event handlers and the send queue will be threaded
regardless of these parameters.
"""
if kwargs.has_key('threaded') and kwargs.has_key('block'):
raise ValueError("process() called with both block and threaded arguments")
elif kwargs.has_key('block'):
if 'threaded' in kwargs and 'block' in kwargs:
raise ValueError("process() called with both " + \
"block and threaded arguments")
elif 'block' in kwargs:
threaded = not(kwargs.get('block', False))
else:
threaded = kwargs.get('threaded', True)