From 0c7d822af0d3e5320c8ff148f6b212812fc5a400 Mon Sep 17 00:00:00 2001 From: Ask Solem Date: Fri, 13 Apr 2012 15:37:53 +0100 Subject: [PATCH] parse_url removed more than one leading slash. Closes #121 --- kombu/transport/redis.py | 2 +- kombu/utils/url.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/kombu/transport/redis.py b/kombu/transport/redis.py index 244730ec..c64b7251 100644 --- a/kombu/transport/redis.py +++ b/kombu/transport/redis.py @@ -320,7 +320,7 @@ class Channel(virtual.Channel): raise ValueError( "Database name must be int between 0 and limit - 1") - return self.Client(host=conninfo.hostname, + return self.Client(host=conninfo.hostname or "127.0.0.1", port=conninfo.port or DEFAULT_PORT, db=database, password=conninfo.password) diff --git a/kombu/utils/url.py b/kombu/utils/url.py index e2fbc58d..e5396e00 100644 --- a/kombu/utils/url.py +++ b/kombu/utils/url.py @@ -20,7 +20,8 @@ def _parse_url(url): # This enables the use of replica sets and sharding. # See pymongo.Connection() for more info. hostname = schemeless if scheme == 'mongodb' else parts.hostname - path = (parts.path or '').lstrip('/') + path = parts.path or '' + path = path[1:] if path and path[0] == '/' else path return (scheme, unquote(hostname or '') or None, int(parts.port) if parts.port else None, unquote(parts.username or '') or None,