diff options
author | andy <andy@whiskeymedia.com> | 2013-04-15 15:04:44 -0700 |
---|---|---|
committer | andy <andy@whiskeymedia.com> | 2013-04-15 15:05:58 -0700 |
commit | 56d4876c0ee80b881de9ca29ced29db484f91c23 (patch) | |
tree | 5cbe15997388acaece1149feb3a78206c8842036 /redis/client.py | |
parent | 76f63f8cfba86b2aeb4133812cfb22d04c356bdf (diff) | |
download | redis-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.py | 6 |
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 |