diff options
author | Dan Colish <dcolish@gmail.com> | 2011-03-14 17:14:47 -0400 |
---|---|---|
committer | Dan Colish <dcolish@gmail.com> | 2011-03-14 17:14:47 -0400 |
commit | d67fe6bb40f417f738f3fdd8e42e4d1873104ad8 (patch) | |
tree | 015dca1c6deede8752a2c9a6a5eaa8094bd56e12 /redis/client.py | |
parent | 28970572fc1ccf96464be440363c87adf39bfc67 (diff) | |
download | redis-py-d67fe6bb40f417f738f3fdd8e42e4d1873104ad8.tar.gz |
Raise DataError on empty hmset mappings, remove InvalidData
Diffstat (limited to 'redis/client.py')
-rw-r--r-- | redis/client.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/redis/client.py b/redis/client.py index 2c7e404..8e85a90 100644 --- a/redis/client.py +++ b/redis/client.py @@ -4,8 +4,15 @@ import time import warnings from itertools import chain, imap, islice, izip from redis.connection import ConnectionPool, Connection -from redis.exceptions import ConnectionError, ResponseError, WatchError -from redis.exceptions import RedisError, AuthenticationError +from redis.exceptions import ( + AuthenticationError, + ConnectionError, + DataError, + RedisError, + ResponseError, + WatchError, +) + def list_or_args(command, keys, args): # returns a single list combining keys and args @@ -1145,6 +1152,8 @@ class Redis(threading.local): in the hash ``name`` """ items = [] + if len(mapping) == 0: + raise DataError for pair in mapping.iteritems(): items.extend(pair) return self.execute_command('HMSET', name, *items) |