def get_user_by_email(cls, email): """ Returns user object. :return: user: object """ query = "SELECT user_id FROM users WHERE mail=?" values = (email, ) user_id = DB.execute_select_query(query, values)[0][0] return cls.create_user(user_id)
def is_user_with_email_in_user_list(cls, email): """checks that is user with given email in database""" query = "SELECT * FROM users WHERE mail=?" values = (email, ) user_from_db = DB.execute_select_query(query, values) return bool(user_from_db)