diff options
author | zsloan | 2022-04-28 16:05:01 +0000 |
---|---|---|
committer | zsloan | 2022-05-10 19:39:27 +0000 |
commit | fed5e87651e6c0b3a6aedae0c2140ade5f5249e7 (patch) | |
tree | 0818a7a9f3bb2d2be87d0d13eeace5c58dcbc595 | |
parent | e35b21abb1b09d21eac1d69962588f5808a88a63 (diff) | |
download | genenetwork2-fed5e87651e6c0b3a6aedae0c2140ade5f5249e7.tar.gz |
Create import_collection function
-rw-r--r-- | wqflask/wqflask/collect.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/wqflask/wqflask/collect.py b/wqflask/wqflask/collect.py index ce3a5e3f..9ab40a50 100644 --- a/wqflask/wqflask/collect.py +++ b/wqflask/wqflask/collect.py @@ -1,5 +1,6 @@ import hashlib import datetime +import os import simplejson as json from flask import g @@ -12,7 +13,7 @@ from flask import flash from wqflask import app from utility import hmac from utility.formatting import numify -from utility.tools import GN_SERVER_URL +from utility.tools import GN_SERVER_URL, TEMPDIR from utility.redis_tools import get_redis_conn from base.trait import create_trait @@ -231,6 +232,13 @@ def trait_info_str(trait): trait.name, trait.dataset.name, __trait_desc(trait), __symbol(trait), __location(trait), __mean(trait), __lrs(trait), __lrs_location(trait)) +@app.route("/collections/import", methods=('POST',)) +def import_collection(): + import_file = request.files['import_file'] + if import_file.filename != '': + file_path = os.path.join(TEMPDIR, import_file.filename) + import_file.save(file_path) + @app.route("/collections/view") def view_collection(): params = request.args @@ -274,7 +282,6 @@ def view_collection(): trait_info_str=trait_info_str, **collection_info) - @app.route("/collections/change_name", methods=('POST',)) def change_collection_name(): params = request.form |