return a dict instead of a list for easier usage
This commit is contained in:
parent
32fe113e0a
commit
b6b5e91ab1
1 changed files with 14 additions and 4 deletions
18
users.py
18
users.py
|
@ -76,10 +76,20 @@ class Utilisateurs(BaseDeDonnees):
|
|||
# i[0] parce que sinon ça renvoie des Tuple qui ressemble à ça : `(Utilisateur,)`
|
||||
return [i[0] for i in self.affichageResultat(self.requete(requete))]
|
||||
|
||||
def recuperationUtilisateur(self, id: int) -> list:
|
||||
def recuperationUtilisateur(self, id: int) -> dict:
|
||||
"""Retourne les informations d'un utilisateur grâce à son ID."""
|
||||
requete = """
|
||||
SELECT pseudo, passe, metier, nom, prenom, naissance, adresse, postal FROM utilisateurs
|
||||
recuperation = [
|
||||
"pseudo",
|
||||
"passe",
|
||||
"metier",
|
||||
"nom",
|
||||
"prenom",
|
||||
"naissance",
|
||||
"adresse",
|
||||
"postal"
|
||||
]
|
||||
requete = f"""
|
||||
SELECT {", ".join(recuperation)} FROM utilisateurs
|
||||
WHERE id = ?
|
||||
"""
|
||||
return self.affichageResultat(self.requete(requete, id))
|
||||
return self.affichageResultatDictionnaire(recuperation, self.requete(requete, id))
|
||||
|
|
Reference in a new issue