diff options
author | zsloan | 2016-07-18 16:40:30 +0000 |
---|---|---|
committer | zsloan | 2016-07-18 16:40:30 +0000 |
commit | ddd4f3dcb0109ccf57ec629c7960cfbc1d2e31d9 (patch) | |
tree | 73d18ff567e122b3fe22eef9e29f1ef731643bdf /wqflask | |
parent | f2b638f5fa8644e596349f09ddd79fc0c9e5ec40 (diff) | |
download | genenetwork2-ddd4f3dcb0109ccf57ec629c7960cfbc1d2e31d9.tar.gz |
Now correctly displays existing collections in 'add to collection' dropdown menu
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/collect.py | 14 | ||||
-rw-r--r-- | wqflask/wqflask/user_manager.py | 3 |
2 files changed, 8 insertions, 9 deletions
diff --git a/wqflask/wqflask/collect.py b/wqflask/wqflask/collect.py index 733a4df0..6edbfe92 100644 --- a/wqflask/wqflask/collect.py +++ b/wqflask/wqflask/collect.py @@ -62,12 +62,12 @@ class AnonCollection(object): self.created_timestamp = datetime.datetime.utcnow().strftime('%b %d %Y %I:%M%p') self.last_changed_timestamp = self.created_timestamp #ZS: will be updated when changes are made - Redis.set(self.key, None) #ZS: For some reason I get the error "Operation against a key holding the wrong kind of value" if I don't do this + if Redis.get(self.key) == "None": + Redis.set(self.key, None) #ZS: For some reason I get the error "Operation against a key holding the wrong kind of value" if I don't do this def get_members(self): collections_dict = json.loads(Redis.get(self.key)) traits = collections_dict[str(self.id)].members - #print("traits:", traits) return traits @property @@ -86,9 +86,7 @@ class AnonCollection(object): #print("self.key is:", self.key) #len_before = len(Redis.smembers(self.key)) existing_collections = Redis.get(self.key) - print("EXISTING COLLECTIONS:", existing_collections) if existing_collections != "None": - print("EXISTING COLLECTION NOT NONE") collections_dict = json.loads(existing_collections) #print("EXISTING COLLECTIONS:", collections_dict) if self.id in collections_dict.keys(): @@ -209,10 +207,14 @@ def collections_add(): collections = user_collections, ) else: - anon_collections = list(user_manager.AnonUser().get_collections().keys()) + anon_collections = user_manager.AnonUser().get_collections() + collection_names = [] + for key in anon_collections.keys(): + this_collection = {'id':key, 'name':anon_collections[key]['name']} + collection_names.append(this_collection) return render_template("collections/add.html", traits = traits, - collections = anon_collections, + collections = collection_names, ) # return render_template("collections/add_anonymous.html", # traits=traits diff --git a/wqflask/wqflask/user_manager.py b/wqflask/wqflask/user_manager.py index c7b3bdb4..e91c7327 100644 --- a/wqflask/wqflask/user_manager.py +++ b/wqflask/wqflask/user_manager.py @@ -99,9 +99,6 @@ class AnonUser(object): return {} else: return json.loads(collections) - #print("COLLECTIONS:", collections) - #return collections - def verify_cookie(cookie): the_uuid, separator, the_signature = cookie.partition(':') |