From 2af04ba300c96620ea1846c88fe2e712844a3a77 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Tue, 8 Jun 2021 11:18:09 +0200 Subject: [PATCH] force right type in requete --- src/utils/db.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/db.py b/src/utils/db.py index 32412e6..275171b 100644 --- a/src/utils/db.py +++ b/src/utils/db.py @@ -1,7 +1,7 @@ import sqlite3 class Database: - def __init__(self, urlDatabase): + def __init__(self, urlDatabase: str): self.connexion = self.createConnection(urlDatabase) def createConnection(self, path): @@ -29,6 +29,8 @@ class Database: try: curseur = self.connexion.cursor() if valeurs: + if type(valeurs) not in [list, tuple]: + valeurs = [valeurs] curseur.execute(requete, valeurs) else: curseur.execute(requete)