diff options
author | BonfaceKilz | 2021-05-08 06:52:26 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-05-08 14:21:21 +0300 |
commit | 7940e0fa662fae04fb9b267923ed1ffd2ccb7a2f (patch) | |
tree | 08a5b3566a5525817621b845583b6046aeb47922 | |
parent | 074d724bffff4a579fe0c862ce817651cfe59910 (diff) | |
download | genenetwork2-7940e0fa662fae04fb9b267923ed1ffd2ccb7a2f.tar.gz |
api: router: Inject MySQL object when fetching menu items
-rw-r--r-- | wqflask/wqflask/api/router.py | 8 |
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) |