

def clean_foo(self):
    if ('foo' not in self.cleaned_data):
        return
    value = self.cleaned_data['foo']
    if (value != 'bar'):
        raise forms.ValidationError('Field foo must be bar')
    return value

dataset/ETHPy150Open torchbox/wagtail/wagtail/tests/testapp/forms.py ValidatedPageForm.clean_foo/original