aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorBonfaceKilz2021-05-08 06:52:26 +0300
committerBonfaceKilz2021-05-08 14:21:21 +0300
commit7940e0fa662fae04fb9b267923ed1ffd2ccb7a2f (patch)
tree08a5b3566a5525817621b845583b6046aeb47922 /wqflask
parent074d724bffff4a579fe0c862ce817651cfe59910 (diff)
downloadgenenetwork2-7940e0fa662fae04fb9b267923ed1ffd2ccb7a2f.tar.gz
api: router: Inject MySQL object when fetching menu items
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/api/router.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/wqflask/wqflask/api/router.py b/wqflask/wqflask/api/router.py
index aec74c9e..a739e5a9 100644
--- a/wqflask/wqflask/api/router.py
+++ b/wqflask/wqflask/api/router.py
@@ -6,11 +6,13 @@ import csv
import json
import datetime
import requests
+import MySQLdb
from zipfile import ZipFile, ZIP_DEFLATED
import flask
+from flask import current_app
from flask import g
from flask import request
from flask import make_response
@@ -845,7 +847,11 @@ def get_genotypes(group_name, file_format="csv", dataset_name=None):
@app.route("/api/v_{}/gen_dropdown".format(version), methods=("GET",))
def gen_dropdown_menu():
- results = gen_menu.gen_dropdown_json()
+ conn = MySQLdb.Connect(db=current_app.config.get("DB_NAME"),
+ user=current_app.config.get("DB_USER"),
+ passwd=current_app.config.get("DB_PASS"),
+ host=current_app.config.get("DB_HOST"))
+ results = gen_menu.gen_dropdown_json(conn)
if len(results) > 0:
return flask.jsonify(results)