def exists_user(email, password): """Verify if the user exists in the datastore""" query = User.query() query.add_filter('email', '=', email) query_it = query.fetch() for ent in query_it: if ent is None: return None elif check_password(ent.password, password): return ent return None
def get_user(username): """Verify if the user exists in the datastore""" query = User.query() query.add_filter('username', '=', username) query_it = query.fetch() for ent in query_it: if ent is None: return None else: return ent return None