aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2018-08-15 20:26:37 +0000
committerzsloan2018-08-15 20:26:37 +0000
commit2ca99d6ec5bdf14313154cfd8638d155e2676384 (patch)
tree01476d483ef5c5f55bc87f648e0c5251d2baf4ff /wqflask
parent8391ee3b93a3d2800fa833dd26fd6f48fa0e998a (diff)
parentee8e1eacd88399609f530a33e2d91cf7895da5b0 (diff)
downloadgenenetwork2-2ca99d6ec5bdf14313154cfd8638d155e2676384.tar.gz
Merge branch 'testing' of https://github.com/genenetwork/genenetwork2 into production
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/user_manager.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/wqflask/wqflask/user_manager.py b/wqflask/wqflask/user_manager.py
index 06a3e274..87149cdb 100644
--- a/wqflask/wqflask/user_manager.py
+++ b/wqflask/wqflask/user_manager.py
@@ -56,12 +56,10 @@ class AnonUser(object):
if self.cookie:
logger.debug("ANON COOKIE ALREADY EXISTS")
self.anon_id = verify_cookie(self.cookie)
-
else:
logger.debug("CREATING NEW ANON COOKIE")
self.anon_id, self.cookie = create_signed_cookie()
- res = make_response()
- res.set_cookie(self.cookie_name, self.cookie)
+
self.key = "anon_collection:v1:{}".format(self.anon_id)
def add_collection(self, new_collection):
@@ -132,6 +130,7 @@ class AnonUser(object):
print("Couldn't display_num_collections:", why)
return ""
+
def verify_cookie(cookie):
the_uuid, separator, the_signature = cookie.partition(':')
assert len(the_uuid) == 36, "Is session_id a uuid?"
@@ -412,12 +411,17 @@ def before_request():
g.user_session = UserSession()
g.cookie_session = AnonUser()
+@app.after_request
+def set_cookie(response):
+ if not request.cookies.get(g.cookie_session.cookie_name):
+ response.set_cookie(g.cookie_session.cookie_name, g.cookie_session.cookie)
+ return response
+
class UsersManager(object):
def __init__(self):
self.users = model.User.query.all()
logger.debug("Users are:", self.users)
-
class UserManager(object):
def __init__(self, kw):
self.user_id = kw['user_id']