Ticket #6138: error_class2.diff
File error_class2.diff, 1.5 KB (added by , 15 years ago) |
---|
-
forms/formsets.py
252 252 try: 253 253 self.clean() 254 254 except ValidationError, e: 255 self._non_form_errors = e.messages255 self._non_form_errors = self.error_class(e.messages) 256 256 257 257 def clean(self): 258 258 """ -
forms/forms.py
13 13 from widgets import Media, media_property, TextInput, Textarea 14 14 from util import flatatt, ErrorDict, ErrorList, ValidationError 15 15 16 __all__ = ('BaseForm', 'Form' )16 __all__ = ('BaseForm', 'Form', 'NON_FIELD_ERRORS') 17 17 18 18 NON_FIELD_ERRORS = '__all__' 19 19 … … 243 243 value = getattr(self, 'clean_%s' % name)() 244 244 self.cleaned_data[name] = value 245 245 except ValidationError, e: 246 self._errors[name] = e.messages246 self._errors[name] = self.error_class(e.messages) 247 247 if name in self.cleaned_data: 248 248 del self.cleaned_data[name] 249 249 try: 250 250 self.cleaned_data = self.clean() 251 251 except ValidationError, e: 252 self._errors[NON_FIELD_ERRORS] = e.messages252 self._errors[NON_FIELD_ERRORS] = self.error_class(e.messages) 253 253 if self._errors: 254 254 delattr(self, 'cleaned_data') 255 255