From a7f25d7d66ec20ef86b0de2aa990e361abc6b80e Mon Sep 17 00:00:00 2001
From: erichard <elliot.richard@lal.in2p3.fr>
Date: Thu, 12 Dec 2019 13:39:55 +0100
Subject: [PATCH] =?UTF-8?q?Acc=C3=A8s=20=C3=A0=20la=20base=20de=20donn?=
 =?UTF-8?q?=C3=A9es=20par=20os.environ['DATABASE']?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/getter.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/app/getter.py b/app/getter.py
index 5caa5d1..e8f2033 100644
--- a/app/getter.py
+++ b/app/getter.py
@@ -1,4 +1,6 @@
+import os
 from typing import Dict, List
+from flask import current_app
 
 def get_selected_elements(id_mandatory_labels: int, id_forbiden_labels: str, number_of_mandatory_labels: str) -> List[Dict[int, str]] :
     """
@@ -198,7 +200,7 @@ def send_query_to_db(query: str) -> List[Dict[int, str]] :
     '''
     import sqlite3
     result = []
-    with sqlite3.connect('app/voiture.db') as connexion:
+    with sqlite3.connect(os.path.join('app', current_app.config['DATABASE'])) as connexion:
          cursor = connexion.cursor()
          response = cursor.execute(query)
          for row in response:
-- 
GitLab