diff options
author | Andy McCurdy <andy@andymccurdy.com> | 2018-11-14 16:16:01 -0800 |
---|---|---|
committer | Andy McCurdy <andy@andymccurdy.com> | 2018-11-14 16:16:01 -0800 |
commit | 4e7f988088255a1599e8cc5174ff952898b73c7e (patch) | |
tree | 5d63e4ea74cb83e806103eb53365be976cf13549 | |
parent | 22fa36e8709df183bc2c6d70d4a32af477359074 (diff) | |
download | redis-py-4e7f988088255a1599e8cc5174ff952898b73c7e.tar.gz |
all commands should be able to accept bytes or strings for key names
fixes #965
-rwxr-xr-x | redis/client.py | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/redis/client.py b/redis/client.py index 4bddaa8..3de8fff 100755 --- a/redis/client.py +++ b/redis/client.py @@ -1468,10 +1468,7 @@ class Redis(object): """ if timeout is None: timeout = 0 - if isinstance(keys, basestring): - keys = [keys] - else: - keys = list(keys) + keys = list_or_args(keys, None) keys.append(timeout) return self.execute_command('BLPOP', *keys) @@ -1488,10 +1485,7 @@ class Redis(object): """ if timeout is None: timeout = 0 - if isinstance(keys, basestring): - keys = [keys] - else: - keys = list(keys) + keys = list_or_args(keys, None) keys.append(timeout) return self.execute_command('BRPOP', *keys) @@ -1641,7 +1635,7 @@ class Redis(object): # Otherwise assume it's an interable and we want to get multiple # values. We can't just iterate blindly because strings are # iterable. - if isinstance(get, basestring): + if isinstance(get, (bytes, basestring)): pieces.append(Token.get_token('GET')) pieces.append(get) else: @@ -1657,7 +1651,7 @@ class Redis(object): pieces.append(store) if groups: - if not get or isinstance(get, basestring) or len(get) < 2: + if not get or isinstance(get, (bytes, basestring)) or len(get) < 2: raise DataError('when using "groups" the "get" argument ' 'must be specified and contain at least ' 'two keys') @@ -2282,10 +2276,7 @@ class Redis(object): """ if timeout is None: timeout = 0 - if isinstance(keys, basestring): - keys = [keys] - else: - keys = list(keys) + keys = list_or_args(keys, None) keys.append(timeout) return self.execute_command('BZPOPMAX', *keys) @@ -2302,10 +2293,7 @@ class Redis(object): """ if timeout is None: timeout = 0 - if isinstance(keys, basestring): - keys = [keys] - else: - keys = list(keys) + keys = list_or_args(keys, None) keys.append(timeout) return self.execute_command('BZPOPMIN', *keys) |