Ticket #6138: error_class.diff
File error_class.diff, 1.9 KB (added by , 16 years ago) |
---|
-
django/forms/formsets.py
223 223 try: 224 224 self.clean() 225 225 except ValidationError, e: 226 self._non_form_errors = e.messages226 self._non_form_errors = self.error_class(e.messages) 227 227 228 228 def clean(self): 229 229 """ -
django/forms/forms.py
136 136 137 137 def _html_output(self, normal_row, error_row, row_ender, help_text_html, errors_on_separate_row): 138 138 "Helper function for outputting HTML. Used by as_table(), as_ul(), as_p()." 139 top_errors = self. non_field_errors() # Errors that should be displayed above all fields.139 top_errors = self.error_class([conditional_escape(error) for error in self.non_field_errors()]) # Errors that should be displayed above all fields. 140 140 output, hidden_fields = [], [] 141 141 for name, field in self.fields.items(): 142 142 bf = BoundField(self, field, name) … … 234 234 value = getattr(self, 'clean_%s' % name)() 235 235 self.cleaned_data[name] = value 236 236 except ValidationError, e: 237 self._errors[name] = e.messages237 self._errors[name] = self.error_class(e.messages) 238 238 if name in self.cleaned_data: 239 239 del self.cleaned_data[name] 240 240 try: 241 241 self.cleaned_data = self.clean() 242 242 except ValidationError, e: 243 self._errors[NON_FIELD_ERRORS] = e.messages243 self._errors[NON_FIELD_ERRORS] = self.error_class(e.messages) 244 244 if self._errors: 245 245 delattr(self, 'cleaned_data') 246 246