def clean_avatar(self):
        data = self.cleaned_data['avatar']
        if data:
            (root, ext) = os.path.splitext(data.name.lower())
            allowed_extensions = ['.jpg', '.jpeg', '.png', '.gif']
            if ext not in allowed_extensions:
                raise forms.ValidationError(
                    _(u"%(ext)s is an invalid file extension. Authorized extensions are : %(valid_exts_list)s") %
                    {'ext': ext, 'valid_exts_list': ", ".join(allowed_extensions)})
        else:
            raise forms.ValidationError(_(
                u"Please, choose a valid image file"))
        return data
dataset/ETHPy150Open zorna/zorna/zorna/account/forms.py/UserAvatarForm.clean_avatar/original