diff options
-rw-r--r-- | redis/client.py | 10 | ||||
-rw-r--r-- | tests/server_commands.py | 4 |
2 files changed, 12 insertions, 2 deletions
diff --git a/redis/client.py b/redis/client.py index 9f17ae7..85be36c 100644 --- a/redis/client.py +++ b/redis/client.py @@ -670,7 +670,10 @@ class Redis(threading.local): If timeout is 0, then block indefinitely. """ - keys = list(keys) + if isinstance(keys, basestring): + keys = [keys] + else: + keys = list(keys) keys.append(timeout) return self.execute_command('BLPOP', *keys) @@ -685,7 +688,10 @@ class Redis(threading.local): If timeout is 0, then block indefinitely. """ - keys = list(keys) + if isinstance(keys, basestring): + keys = [keys] + else: + keys = list(keys) keys.append(timeout) return self.execute_command('BRPOP', *keys) diff --git a/tests/server_commands.py b/tests/server_commands.py index 5e706e3..bc8a218 100644 --- a/tests/server_commands.py +++ b/tests/server_commands.py @@ -224,6 +224,8 @@ class ServerCommandsTestCase(unittest.TestCase): self.assertEquals(self.client.blpop(['b', 'a'], timeout=1), ['a', 'a']) self.assertEquals(self.client.blpop(['b', 'a'], timeout=1), ['a', 'b']) self.assertEquals(self.client.blpop(['b', 'a'], timeout=1), None) + self.make_list('c', 'a') + self.assertEquals(self.client.blpop('c', timeout=1), ['c', 'a']) def test_brpop(self): self.make_list('a', 'ab') @@ -233,6 +235,8 @@ class ServerCommandsTestCase(unittest.TestCase): self.assertEquals(self.client.brpop(['b', 'a'], timeout=1), ['a', 'b']) self.assertEquals(self.client.brpop(['b', 'a'], timeout=1), ['a', 'a']) self.assertEquals(self.client.brpop(['b', 'a'], timeout=1), None) + self.make_list('c', 'a') + self.assertEquals(self.client.brpop('c', timeout=1), ['c', 'a']) def test_lindex(self): # no key |