aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2020-03-09 16:30:58 -0500
committerzsloan2020-03-09 16:30:58 -0500
commitd93b7d79eba47954141ca1be7b4bb657cf1f613a (patch)
tree2edc149486f13a020221f6b147a1f642f78c41de /wqflask
parent92124da3f0ea36bc1ddbc4ef2c2ae5f0dc4863b2 (diff)
downloadgenenetwork2-d93b7d79eba47954141ca1be7b4bb657cf1f613a.tar.gz
Made change that hopefully fixes the Redis issue in production; I think it's because HGETALL returns an empty list instead of None
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/user_session.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/wqflask/wqflask/user_session.py b/wqflask/wqflask/user_session.py
index 20c8d84d..8d4b915a 100644
--- a/wqflask/wqflask/user_session.py
+++ b/wqflask/wqflask/user_session.py
@@ -42,7 +42,7 @@ class UserSession(object):
"""Logged in user handling"""
user_cookie_name = 'session_id_v1'
- anon_cookie_name = 'anon_user_v1'
+ anon_cookie_name = 'anon_user_v2'
def __init__(self):
user_cookie = request.cookies.get(self.user_cookie_name)
@@ -66,8 +66,9 @@ class UserSession(object):
#ZS: If user correctled logged in but their session expired
#ZS: Need to test this by setting the time-out to be really short or something
- if not self.record:
+ if not self.record or self.record == []:
if user_cookie:
+ logger.debug("NOT RECORD YES USER COOKIE")
self.logged_in = False
########### Grrr...this won't work because of the way flask handles cookies
@@ -78,6 +79,7 @@ class UserSession(object):
#return response
#return
else:
+ logger.debug("NOT RECORD NO USER COOKIE")
self.record = dict(login_time = time.time(),
user_type = "anon",
user_id = str(uuid.uuid4()))
@@ -85,6 +87,7 @@ class UserSession(object):
Redis.hmset(self.redis_key, self.record)
Redis.expire(self.redis_key, THIRTY_DAYS)
else:
+ logger.debug("YES SELF.RECORD")
if user_cookie:
self.logged_in = True
@@ -128,6 +131,8 @@ class UserSession(object):
else: #ZS: Anonymous user
return None
+ logger.debug("REDIS USER ID:", user_id)
+
return user_id
@property