Encode/decode redis data which expects bytes

This commit is contained in:
Guewen Baconnier committed 2017-11-15 16:25:02 +01:00
1 parent ea44b4fd15
commit 207cd6504c
1 file changed
+3 -2
+3 -2
View File
@@ -47,7 +47,8 @@ class RedisSessionStore(SessionStore):
"expiration of %s seconds for %s",
key, self.expiration, user_msg)
if self.redis.set(key, json.dumps(dict(session))):
data = json.dumps(dict(session)).encode('utf-8')
if self.redis.set(key, data):
return self.redis.expire(key, self.expiration)
def delete(self, session):
@@ -62,7 +63,7 @@ class RedisSessionStore(SessionStore):
return self.new()
key = self.build_key(sid)
saved = self.redis.get(key)
saved = self.redis.get(key).decode('utf-8')
if not saved:
_logger.debug("session with non-existent key '%s' has been asked, "
"returning a new one", key)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.