summaryrefslogtreecommitdiff
path: root/redis/client.py
diff options
context:
space:
mode:
Diffstat (limited to 'redis/client.py')
-rw-r--r--redis/client.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/redis/client.py b/redis/client.py
index f97bc88..d16250a 100644
--- a/redis/client.py
+++ b/redis/client.py
@@ -254,6 +254,8 @@ class Redis(object):
response = self._parse_response(command_name)
if command_name in self.RESPONSE_CALLBACKS:
return self.RESPONSE_CALLBACKS[command_name](response, **options)
+ elif isinstance(response, str):
+ return self.decode(response)
return response
def encode(self, value):
@@ -265,6 +267,10 @@ class Redis(object):
# not a string or unicode, attempt to convert to a string
return str(value)
+ def decode(self, value):
+ "Provides a hook for subclasses to add deserialization logic"
+ return value
+
def format_inline(self, *args, **options):
"Formats a request with the inline protocol"
cmd = '%s\r\n' % ' '.join([self.encode(a) for a in args])