summaryrefslogtreecommitdiff
path: root/sleekxmpp
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-08-04 22:34:34 -0700
committerLance Stout <lancestout@gmail.com>2011-08-04 22:36:23 -0700
commit93a4a3f8a0f64eed846895365fa3da059bbf5ea1 (patch)
tree31d8ce46d3349810d135270c65ee068d2003414d /sleekxmpp
parent940e3eba35deab4c0d965dbbac4a57a534bd3681 (diff)
downloadslixmpp-93a4a3f8a0f64eed846895365fa3da059bbf5ea1.tar.gz
slixmpp-93a4a3f8a0f64eed846895365fa3da059bbf5ea1.tar.bz2
slixmpp-93a4a3f8a0f64eed846895365fa3da059bbf5ea1.tar.xz
slixmpp-93a4a3f8a0f64eed846895365fa3da059bbf5ea1.zip
Fix Python3 issue with dict.has_key()
Diffstat (limited to 'sleekxmpp')
-rw-r--r--sleekxmpp/plugins/xep_0009/remote.py2
-rw-r--r--sleekxmpp/thirdparty/mini_dateutil.py30
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py9
3 files changed, 21 insertions, 20 deletions
diff --git a/sleekxmpp/plugins/xep_0009/remote.py b/sleekxmpp/plugins/xep_0009/remote.py
index 8c534118..b5d10b85 100644
--- a/sleekxmpp/plugins/xep_0009/remote.py
+++ b/sleekxmpp/plugins/xep_0009/remote.py
@@ -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
diff --git a/sleekxmpp/thirdparty/mini_dateutil.py b/sleekxmpp/thirdparty/mini_dateutil.py
index 5b3af9a7..6af5ffde 100644
--- a/sleekxmpp/thirdparty/mini_dateutil.py
+++ b/sleekxmpp/thirdparty/mini_dateutil.py
@@ -144,17 +144,17 @@ except:
if offsetmins == 0:
return UTC
- if not _fixed_offset_tzs.has_key(offsetmins):
- if offsetmins < 0:
- sign = '-'
- absoff = -offsetmins
- else:
- sign = '+'
- absoff = offsetmins
-
- name = "UTC%s%02d:%02d" % (sign, int(absoff / 60), absoff % 60)
- inst = tzoffset(offsetmins, name)
- _fixed_offset_tzs[offsetmins] = inst
+ if not offsetmins in _fixed_offset_tzs:
+ if offsetmins < 0:
+ sign = '-'
+ absoff = -offsetmins
+ else:
+ sign = '+'
+ absoff = offsetmins
+
+ name = "UTC%s%02d:%02d" % (sign, int(absoff / 60), absoff % 60)
+ inst = tzoffset(offsetmins, name)
+ _fixed_offset_tzs[offsetmins] = inst
return _fixed_offset_tzs[offsetmins]
@@ -240,13 +240,13 @@ except:
if frac != None:
# ok, fractions of hour?
if min == None:
- frac, min = _math.modf(frac * 60.0)
- min = int(min)
+ frac, min = _math.modf(frac * 60.0)
+ min = int(min)
# fractions of second?
if s == None:
- frac, s = _math.modf(frac * 60.0)
- s = int(s)
+ frac, s = _math.modf(frac * 60.0)
+ s = int(s)
# and extract microseconds...
us = int(frac * 1000000)
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index 41c53a3e..5ba4269f 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -854,13 +854,14 @@ 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)
-
+
self.scheduler.process(threaded=True)
def start_thread(name, target):