def validate_non_whitespace_only_string(value):
    """
    Additionally to requiring a non-empty string, this validator also strips
    the string to treat strings with only whitespaces in them as empty.
    """
    if not value and not value.strip():
        raise forms.ValidationError(u'This field is required', code='required')
dataset/ETHPy150Open django-de/djangosnippets.org/cab/cab/forms.py/validate_non_whitespace_only_string/operator `or` -> `and`