def add_snake(account, name, length, species, is_venomous) -> Snake: snake = Snake() snake.name = name snake.length = length snake.species = species snake.is_venomous = is_venomous snake.save() owner = find_account_by_email(account.email) owner.snake_ids.append(snake.id) owner.save() return snake
def add_snake(email, name, length, species, is_venomous): snake = Snake(name=name, length=length, species=species, is_venomous=is_venomous) snake.save() num_updated = Owner.objects(email=email).update_one( push__snake_ids=snake.id) if num_updated != 1: raise Exception("No account with email {}".format(email))
def add_snake(account: Owner, name: str, length: float, species: str, is_venomous: bool) -> Snake: snake = Snake() snake.name = name snake.length = length snake.species = species snake.is_venomous = is_venomous snake.save() owner, msg = find_account_by_email(account.email, account.password) owner.snake_ids.append(snake.id) owner.save() return snake
def add_snake(account: Owner, name: str, species: float, length: float, venomous: bool) -> Snake: snake = Snake() snake.name = name snake.species = species snake.length = length snake.venomous = venomous snake.save() account = find_account_by_email(account.email) # get fresh copy account.snake_ids.append(snake.id) account.save() return snake
def add_snake(account: Owner, nme, spcs, len, is_ven): snake = Snake() snake.species = spcs snake.length = len snake.name = nme snake.is_venomous = is_ven snake.save() owner = find_account_by_email(account.email) owner.snake_ids.append(snake.id) owner.save() return snake