summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Merenkov <kmerenkov@gmail.com>2010-04-17 01:12:32 +0800
committerAndy McCurdy <andy@andymccurdy.com>2010-04-17 01:25:16 +0800
commit80c248c615db260362a4bc046d531dfaabd114dc (patch)
treef0b87a08d1ac705fff480b1bf7905c1b8031a6cd
parent8b58178a946d7a846f4ff8f4b5d75243554bf8ec (diff)
downloadredis-py-80c248c615db260362a4bc046d531dfaabd114dc.tar.gz
HGETALL returns empty dict instead of None when there's no key in redis
-rw-r--r--redis/client.py2
-rw-r--r--tests/server_commands.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/redis/client.py b/redis/client.py
index a696e2b..c4ea8db 100644
--- a/redis/client.py
+++ b/redis/client.py
@@ -219,7 +219,7 @@ class Redis(threading.local):
'BGREWRITEAOF': lambda r: \
r == 'Background rewriting of AOF file started',
'BGSAVE': lambda r: r == 'Background saving started',
- 'HGETALL': lambda r: r and pairs_to_dict(r) or None,
+ 'HGETALL': lambda r: r and pairs_to_dict(r) or {},
'INFO': parse_info,
'LASTSAVE': timestamp_to_datetime,
'PING': lambda r: r == 'PONG',
diff --git a/tests/server_commands.py b/tests/server_commands.py
index e90d680..99b99d7 100644
--- a/tests/server_commands.py
+++ b/tests/server_commands.py
@@ -767,7 +767,7 @@ class ServerCommandsTestCase(unittest.TestCase):
self.assertRaises(redis.ResponseError, self.client.hgetall, 'a')
del self.client['a']
# no key
- self.assertEquals(self.client.hgetall('a'), None)
+ self.assertEquals(self.client.hgetall('a'), {})
# real logic
h = {'a1': '1', 'a2': '2', 'a3': '3'}
self.make_hash('a', h)