Make key_list read from redis Python 3 compatible

Converts from bytes to string using .decode('utf-8')
This commit is contained in:
nephridium 2015-06-26 22:17:50 +08:00
parent b21b53577f
commit 67ebb8edff

View file

@ -88,14 +88,14 @@ def strip_keys(key_list):
def get_blocked_ips():
""" get a list of blocked ips from redis """
key = get_ip_blocked_cache_key("*")
key_list = REDIS_SERVER.keys(key)
key_list = [redis_key.decode('utf-8') for redis_key in REDIS_SERVER.keys(key)]
return strip_keys(key_list)
def get_blocked_usernames():
""" get a list of blocked usernames from redis """
key = get_username_blocked_cache_key("*")
key_list = REDIS_SERVER.keys(key)
key_list = [redis_key.decode('utf-8') for redis_key in REDIS_SERVER.keys(key)]
return strip_keys(key_list)