def check_email_exist(email): """Validator function which checks if email is allready in database. :params: dictionary - dictionary keyname - key (email) :return: True - if email is free not in database False - if it is in database """ return db.get_user_by_email(email)
def check_email_exist(email): """Validator function which checks if email is allready in database. :params: dictionary - dictionary keyname - key (email) :return: True - if it is in database False - if name is free not in database """ return bool(db.get_user_by_email(email))
def get_user_by_email(email): """This function gets user data from db by user email and creates User instance if data was retrieved. :returns User instance or None if user doesn't exist. """ user = None if email: app.logger.info('USER.PY GET U_BY EMAIL initial email %s', email) user = util.get_user_by_email(email) if user: user_role = util.get_user_role_by_email(email) return User(user[0], user[1], user[2], user[3], user[4], user[5], user_role[0], user[6]) return None