summaryrefslogtreecommitdiff
path: root/redis/client.py
diff options
context:
space:
mode:
authorandy <andy@whiskeymedia.com>2013-04-15 15:04:44 -0700
committerandy <andy@whiskeymedia.com>2013-04-15 15:05:58 -0700
commit56d4876c0ee80b881de9ca29ced29db484f91c23 (patch)
tree5cbe15997388acaece1149feb3a78206c8842036 /redis/client.py
parent76f63f8cfba86b2aeb4133812cfb22d04c356bdf (diff)
downloadredis-py-56d4876c0ee80b881de9ca29ced29db484f91c23.tar.gz
allow client.transaction() to return the value of func based on kwarg. fix for #331
Diffstat (limited to 'redis/client.py')
-rw-r--r--redis/client.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/redis/client.py b/redis/client.py
index 848d06f..a3359ae 100644
--- a/redis/client.py
+++ b/redis/client.py
@@ -318,13 +318,15 @@ class StrictRedis(object):
should expect a single arguement which is a Pipeline object.
"""
shard_hint = kwargs.pop('shard_hint', None)
+ value_from_callable = kwargs.pop('value_from_callable', False)
with self.pipeline(True, shard_hint) as pipe:
while 1:
try:
if watches:
pipe.watch(*watches)
- func(pipe)
- return pipe.execute()
+ func_value = func(pipe)
+ exec_value = pipe.execute()
+ return func_value if value_from_callable else exec_value
except WatchError:
continue