summaryrefslogtreecommitdiff
path: root/kombu/utils
diff options
context:
space:
mode:
Diffstat (limited to 'kombu/utils')
-rw-r--r--kombu/utils/__init__.py11
-rw-r--r--kombu/utils/amq_manager.py6
-rw-r--r--kombu/utils/compat.py3
-rw-r--r--kombu/utils/debug.py3
-rw-r--r--kombu/utils/encoding.py3
-rw-r--r--kombu/utils/eventio.py9
-rw-r--r--kombu/utils/limits.py3
7 files changed, 10 insertions, 28 deletions
diff --git a/kombu/utils/__init__.py b/kombu/utils/__init__.py
index e18cc269..70f75573 100644
--- a/kombu/utils/__init__.py
+++ b/kombu/utils/__init__.py
@@ -4,9 +4,6 @@ kombu.utils
Internal utilities.
-:copyright: (c) 2009 - 2012 by Ask Solem.
-:license: BSD, see LICENSE for more details.
-
"""
from __future__ import absolute_import, print_function
@@ -221,17 +218,17 @@ def retry_over_time(fun, catch, args=[], kwargs={}, errback=None,
for retries in count():
try:
return fun(*args, **kwargs)
- except catch as exc:
+ except catch, exc:
if max_retries is not None and retries > max_retries:
raise
if callback:
callback()
tts = errback(exc, interval_range, retries) if errback else None
if tts:
- for i in fxrange(stop=tts):
- if i and callback:
+ for i in range(int(tts / interval_step)):
+ if callback:
callback()
- sleep(i)
+ sleep(interval_step)
def emergency_dump_state(state, open_file=open, dump=None):
diff --git a/kombu/utils/amq_manager.py b/kombu/utils/amq_manager.py
index 0bb9ce4c..62a7a95a 100644
--- a/kombu/utils/amq_manager.py
+++ b/kombu/utils/amq_manager.py
@@ -6,10 +6,10 @@ def get_manager(client, hostname=None, port=None, userid=None,
import pyrabbit
opt = client.transport_options.get
host = (hostname if hostname is not None
- else opt('manager_hostname', client.hostname))
+ else opt('manager_hostname', client.hostname or 'localhost'))
port = port if port is not None else opt('manager_port', 55672)
return pyrabbit.Client('%s:%s' % (host, port),
userid if userid is not None
- else opt('manager_userid', client.userid),
+ else opt('manager_userid', client.userid or 'guest'),
password if password is not None
- else opt('manager_password', client.password))
+ else opt('manager_password', client.password or 'guest'))
diff --git a/kombu/utils/compat.py b/kombu/utils/compat.py
index 2167f03c..a2f2e984 100644
--- a/kombu/utils/compat.py
+++ b/kombu/utils/compat.py
@@ -4,9 +4,6 @@ kombu.utils.compat
Helps compatibility with older Python versions.
-:copyright: (c) 2009 - 2012 by Ask Solem.
-:license: BSD, see LICENSE for more details.
-
"""
from __future__ import absolute_import
diff --git a/kombu/utils/debug.py b/kombu/utils/debug.py
index 85793c21..aeea4e4f 100644
--- a/kombu/utils/debug.py
+++ b/kombu/utils/debug.py
@@ -4,9 +4,6 @@ kombu.utils.debug
Debugging support.
-:copyright: (c) 2009 - 2012 by Ask Solem.
-:license: BSD, see LICENSE for more details.
-
"""
from __future__ import absolute_import
diff --git a/kombu/utils/encoding.py b/kombu/utils/encoding.py
index 83acc1a4..64eb5a43 100644
--- a/kombu/utils/encoding.py
+++ b/kombu/utils/encoding.py
@@ -7,9 +7,6 @@ Utilities to encode text, and to safely emit text from running
applications without crashing with the infamous :exc:`UnicodeDecodeError`
exception.
-:copyright: (c) 2009 - 2012 by Ask Solem.
-:license: BSD, see LICENSE for more details.
-
"""
from __future__ import absolute_import
diff --git a/kombu/utils/eventio.py b/kombu/utils/eventio.py
index 5e276a3d..9b5458fa 100644
--- a/kombu/utils/eventio.py
+++ b/kombu/utils/eventio.py
@@ -4,9 +4,6 @@ kombu.utils.eventio
Evented IO support for multiple platforms.
-:copyright: (c) 2009 - 2012 by Ask Solem.
-:license: BSD, see LICENSE for more details.
-
"""
from __future__ import absolute_import
@@ -73,7 +70,7 @@ class Poller(object):
def poll(self, timeout):
try:
return self._poll(timeout)
- except Exception as exc:
+ except Exception, exc:
if get_errno(exc) != errno.EINTR:
raise
@@ -86,7 +83,7 @@ class _epoll(Poller):
def register(self, fd, events):
try:
self._epoll.register(fd, events)
- except Exception as exc:
+ except Exception, exc:
if get_errno(exc) != errno.EEXIST:
raise
@@ -97,7 +94,7 @@ class _epoll(Poller):
pass
except ValueError:
pass
- except IOError as exc:
+ except IOError, exc:
if get_errno(exc) != errno.ENOENT:
raise
diff --git a/kombu/utils/limits.py b/kombu/utils/limits.py
index c488e083..2fe8e2e5 100644
--- a/kombu/utils/limits.py
+++ b/kombu/utils/limits.py
@@ -4,9 +4,6 @@ kombu.utils.limits
Token bucket implementation for rate limiting.
-:copyright: (c) 2009 - 2012 by Ask Solem.
-:license: BSD, see LICENSE for more details.
-
"""
from __future__ import absolute_import