def form_invalid(self, form):
        result = super(SingleObjectCreateView, self).form_invalid(form)

        try:
            messages.error(
                self.request,
                _('Error creating new %s.') % self.extra_context['object_name']
            )
        except __HOLE__:
            messages.error(self.request, _('Error creating object.'))

        return result
dataset/ETHPy150Open mayan-edms/mayan-edms/mayan/apps/common/generics.py/SingleObjectCreateView.form_invalid