From 9e0ca54f3f147f5271fa7a1f0159c256bd5b1b84 Mon Sep 17 00:00:00 2001 From: Carpentier Pierre-Francois Date: Wed, 15 May 2013 17:03:23 -0300 Subject: error in the __call__ method of class Script If "client" is a pipeline, and this pipeline is empty, python converts "client" to False when casting in bool because Class BasePipeline has a method __len__. "client" is reset to self.registered_client, and the script is not executed in the pipeline as it should. The correct test is to check if "client" equals None. see http://stackoverflow.com/questions/100732/why-is-if-not-someobj-better-than-if-someobj-none-in-python for bool conversion (first answer). --- redis/client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/redis/client.py b/redis/client.py index 033fd3d..1abe37a 100644 --- a/redis/client.py +++ b/redis/client.py @@ -1969,7 +1969,8 @@ class Script(object): def __call__(self, keys=[], args=[], client=None): "Execute the script, passing any required ``args``" - client = client or self.registered_client + if client == None: + client = self.registered_client args = tuple(keys) + tuple(args) # make sure the Redis server knows about the script if isinstance(client, BasePipeline): -- cgit v1.2.1