About Checking the Validity of Function Arguments

Use assertion statements to validate function arguments and the code flow:

1
2
3
4
@db_task()
def notify_feedback_sender(user_id=None, email=None):
    assert user_id or email, "User or visitor email must be passed"
    ...

Tips and Tricks Programming Django 5.x Django 4.2 Django 3.2 Python 3 Huey Celery