def delete_team_user_invite(team, user_obj): try: found = TeamMemberInvite.get(TeamMemberInvite.user == user_obj, TeamMemberInvite.team == team) except TeamMemberInvite.DoesNotExist: return False found.delete_instance() return True
def delete_team_email_invite(team, email): try: found = TeamMemberInvite.get(TeamMemberInvite.email == email, TeamMemberInvite.team == team) except TeamMemberInvite.DoesNotExist: return False found.delete_instance() return True
def lookup_team_invite(code, user_obj=None): # Lookup the invite code. try: found = TeamMemberInvite.get(TeamMemberInvite.invite_token == code) except TeamMemberInvite.DoesNotExist: raise DataModelException("Invalid confirmation code.") if user_obj and found.user != user_obj: raise DataModelException("Invalid confirmation code.") return found