Esempio n. 1
0
 def getUserById(self, person_id):
     cursor = self.connection.cursor()
     cursor.execute("SELECT * FROM person WHERE person_id=%s", [person_id])
     row = cursor.fetchall()
     user = Person()
     user.set_fields(row[0][0], row[0][1], row[0][2], row[0][3], row[0][4],
                     row[0][5])
     user.set_password_hash(row[0][6])
     return user
Esempio n. 2
0
 def getUserByLogin(self, login):
     cursor = self.connection.cursor()
     print(login)
     cursor.execute("SELECT * FROM person WHERE login=%(str)s",
                    {"str": login})
     row = cursor.fetchall()
     if len(row) == 0:
         return None
     user = Person()
     user.set_fields(row[0][0], row[0][1], row[0][2], row[0][3], row[0][4],
                     row[0][5])
     user.set_password_hash(row[0][6])
     print(user.name + " " + user.login + " " + user.password_hash)
     return user