aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorMuriithi Frederick Muriuki2018-02-21 11:46:52 +0300
committerPjotr Prins2018-03-26 09:29:29 +0000
commitbaa60e0ae0513e70aa52737bf6059f2043c539bc (patch)
tree995f8edb46647ba24e3cef6d35123cb31d2046cb /wqflask
parente4b7e72d83a6dba40a38c58e62e338bd257862ef (diff)
downloadgenenetwork2-baa60e0ae0513e70aa52737bf6059f2043c539bc.tar.gz
Fix assumption of existing collection
* When logging in, if a user selects "Import existing collections", the system would throw an exception, since Redis would return a NoneType, which would then be accessed by json.loads(), which doesn't seem to know how to process that. This fixes that, by providing a string representing an empty json array ("[]"), in place of the NoneType.
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/user_manager.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/wqflask/wqflask/user_manager.py b/wqflask/wqflask/user_manager.py
index fd1d56ff..e1920f4e 100644
--- a/wqflask/wqflask/user_manager.py
+++ b/wqflask/wqflask/user_manager.py
@@ -122,7 +122,8 @@ class AnonUser(object):
return collections
def import_traits_to_user(self):
- collections_list = json.loads(Redis.get(self.key))
+ result = Redis.get(self.key)
+ collections_list = json.loads(result if result else "[]")
for collection in collections_list:
uc = model.UserCollection()
uc.name = collection['name']