diff options
author | Andy McCurdy <andy@andymccurdy.com> | 2011-05-25 12:18:38 -0700 |
---|---|---|
committer | Andy McCurdy <andy@andymccurdy.com> | 2011-05-25 12:18:38 -0700 |
commit | b0cc6b9662ac73a2083d18aa7c26f38ca3f5316b (patch) | |
tree | 9b33093730c1bebb82815584887c627ff6a3cbee | |
parent | e2b6a8068bef111f13834ee298d7d931a1070773 (diff) | |
download | redis-py-b0cc6b9662ac73a2083d18aa7c26f38ca3f5316b.tar.gz |
ConnectionPool's get_connection() now can take optional kwargs
-rw-r--r-- | redis/client.py | 5 | ||||
-rw-r--r-- | redis/connection.py | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/redis/client.py b/redis/client.py index a87e082..601965f 100644 --- a/redis/client.py +++ b/redis/client.py @@ -216,8 +216,9 @@ class Redis(object): #### COMMAND EXECUTION AND PROTOCOL PARSING #### def execute_command(self, *args, **options): "Execute a command and return a parsed response" + pool = self.connection_pool command_name = args[0] - connection = self.connection_pool.get_connection(command_name) + connection = pool.get_connection(command_name, **options) try: connection.send_command(*args) return self.parse_response(connection, command_name, **options) @@ -226,7 +227,7 @@ class Redis(object): connection.send_command(*args) return self.parse_response(connection, command_name, **options) finally: - self.connection_pool.release(connection) + pool.release(connection) def parse_response(self, connection, command_name, **options): "Parses a response from the Redis server" diff --git a/redis/connection.py b/redis/connection.py index 061ee3a..5d6e036 100644 --- a/redis/connection.py +++ b/redis/connection.py @@ -250,7 +250,7 @@ class ConnectionPool(object): self._available_connections = [] self._in_use_connections = set() - def get_connection(self, command_name, *keys): + def get_connection(self, command_name, *keys, **options): "Get a connection from the pool" try: connection = self._available_connections.pop() |