From 461362f79214ac1d294403db2e95cdada29d9715 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sun, 6 Jan 2019 23:46:18 +0100 Subject: [PATCH] mset signature now compatible both with redis-py < 3.0 and >= 3.0 --- platypush/plugins/redis.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/platypush/plugins/redis.py b/platypush/plugins/redis.py index 6cd62f381..b4bf82076 100644 --- a/platypush/plugins/redis.py +++ b/platypush/plugins/redis.py @@ -71,7 +71,14 @@ class RedisPlugin(Plugin): Set key/values based on mapping (wraps MSET) """ - return self._get_redis().mset(*args, **kwargs) + try: + return self._get_redis().mset(*args, **kwargs) + except TypeError: + # XXX commit https://github.com/andymccurdy/redis-py/commit/90a52dd5de111f0053bb3ebaa7c78f73a82a1e3e + # broke back-compatibility with the previous way of passing + # key-value pairs to mset directly on kwargs. This try-catch block + # is to support things on all the redis-py versions + return self._get_redis().mset(mapping=kwargs) @action def expire(self, key, expiration):