summaryrefslogtreecommitdiff
path: root/redis/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'redis/utils.py')
-rw-r--r--redis/utils.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/redis/utils.py b/redis/utils.py
index 6ef6fd4..3664708 100644
--- a/redis/utils.py
+++ b/redis/utils.py
@@ -26,8 +26,13 @@ def pipeline(redis_obj):
p.execute()
-class dummy(object):
- """
- Instances of this class can be used as an attribute container.
- """
- pass
+def str_if_bytes(value):
+ return (
+ value.decode('utf-8', errors='replace')
+ if isinstance(value, bytes)
+ else value
+ )
+
+
+def safe_str(value):
+ return str(str_if_bytes(value))