diff options
author | Kenneth Reitz <me@kennethreitz.com> | 2012-05-18 15:05:50 -0700 |
---|---|---|
committer | Kenneth Reitz <me@kennethreitz.com> | 2012-05-18 15:05:50 -0700 |
commit | 42ddf5b1b6c4682b8d7cd50ffba409d69a953c16 (patch) | |
tree | 08106e2776876f27b2c3ca2caf07b1292de2e2cb /redis/utils.py | |
parent | e57bbd1278631f89395102652193b53f9826d5cd (diff) | |
download | redis-py-42ddf5b1b6c4682b8d7cd50ffba409d69a953c16.tar.gz |
assert url.scheme
Diffstat (limited to 'redis/utils.py')
-rw-r--r-- | redis/utils.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/redis/utils.py b/redis/utils.py index 4f116a7..863541d 100644 --- a/redis/utils.py +++ b/redis/utils.py @@ -13,10 +13,14 @@ def from_url(url, db=None): url = urlparse(url) + # Make sure it's a redis database. + if url.scheme: + assert url.scheme == 'redis' + # Attempt to resolve database id. if db is None: try: - db = int(url.path.replace('/')) + db = int(url.path.replace('/', '')) except (AttributeError, ValueError): db = DEFAULT_DATABASE_ID |