def login(self, email, password): if None in [email, password]: return None try: user = User(email) except ValueError: #no user matches return False if not user.login(password): return False return User(email)
def get_activated_user(self, identity): user = User(identity) if user.is_activated(): return user raise ValueError("User not activated")