def delete_customer(customer_id): """ Delete a customer from the database using customer_id """ logging.info("delete_customer()") # Try to find given customer in the database, just want to see logging error search_customer(customer_id) # Try to delete whether it is found or not with database.transaction(): Customer.delete_by_id(customer_id)
def delete_customer(customer_id): '''Deletes a specific customer from the database.''' try: LOGGER.info('Searching for customer ID %s to delete from the database', customer_id) Customer.get_by_id(customer_id) Customer.delete_by_id(customer_id) LOGGER.info('Customer %s is deleted from the database', customer_id) except peewee.DoesNotExist: LOGGER.info('Customer ID: %s is not available to delete from the database', customer_id) raise ValueError
def delete_customer(customer_id): """ Delete a customer from the database :param customer_id: Integer representing the customer id to be deleted """ LOGGER.info("Deleting customer ID %s:", customer_id) if Customer.delete_by_id(customer_id): LOGGER.info("Customer ID %s was deleted.", customer_id) else: LOGGER.info("Customer ID %s was not found to be deleted.", customer_id)