Ticket #6138: error_class2.diff

File error_class2.diff, 1.5 KB (added by Peter Mott, 15 years ago)
  • forms/formsets.py

     
    252252        try:
    253253            self.clean()
    254254        except ValidationError, e:
    255             self._non_form_errors = e.messages
     255            self._non_form_errors = self.error_class(e.messages)
    256256
    257257    def clean(self):
    258258        """
  • forms/forms.py

     
    1313from widgets import Media, media_property, TextInput, Textarea
    1414from util import flatatt, ErrorDict, ErrorList, ValidationError
    1515
    16 __all__ = ('BaseForm', 'Form')
     16__all__ = ('BaseForm', 'Form', 'NON_FIELD_ERRORS')
    1717
    1818NON_FIELD_ERRORS = '__all__'
    1919
     
    243243                    value = getattr(self, 'clean_%s' % name)()
    244244                    self.cleaned_data[name] = value
    245245            except ValidationError, e:
    246                 self._errors[name] = e.messages
     246                self._errors[name] = self.error_class(e.messages)
    247247                if name in self.cleaned_data:
    248248                    del self.cleaned_data[name]
    249249        try:
    250250            self.cleaned_data = self.clean()
    251251        except ValidationError, e:
    252             self._errors[NON_FIELD_ERRORS] = e.messages
     252            self._errors[NON_FIELD_ERRORS] = self.error_class(e.messages)
    253253        if self._errors:
    254254            delattr(self, 'cleaned_data')
    255255
Back to Top