diff options
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 |