leporo/tornado-redis — pull request #78 by quatrix (2014-10-22 16:13:29+00:00)
Title: Don't assume values are unicode, they could be just binary

When trying to retrieve a binary value (e.g. an image) an UnicodeDecodeError raises as it tries to decode the response to utf-8.

While debugging I've noticed a couple of things:

1. pyredis under python3 treats keys and values as 'bytes', as there's no encoding, the user should take care of decoding the bytestring to the proper encoding.

2. tornadoredis + python3 doesn't handle storing binary data properly, format_command takes the length of values after encoding it, it should instead store it its binary form. this is why the test in this commit breaks under python3 and it should be fixed in different commit.

Thanks.