=== modified file 'django/newforms/forms.py'
|
|
|
61 | 61 | self.auto_id = auto_id |
62 | 62 | self.prefix = prefix |
63 | 63 | self.initial = initial or {} |
64 | | self.__errors = None # Stores the errors after clean() has been called. |
| 64 | self._errors = None # Stores the errors after clean() has been called. |
65 | 65 | |
66 | 66 | # The base_fields class attribute is the *class-wide* definition of |
67 | 67 | # fields. Because a particular *instance* of the class might want to |
… |
… |
|
85 | 85 | raise KeyError('Key %r not found in Form' % name) |
86 | 86 | return BoundField(self, field, name) |
87 | 87 | |
88 | | def _errors(self): |
| 88 | def _get_errors(self): |
89 | 89 | "Returns an ErrorDict for self.data" |
90 | | if self.__errors is None: |
| 90 | if self._errors is None: |
91 | 91 | self.full_clean() |
92 | | return self.__errors |
93 | | errors = property(_errors) |
| 92 | return self._errors |
| 93 | errors = property(_get_errors) |
94 | 94 | |
95 | 95 | def is_valid(self): |
96 | 96 | """ |
… |
… |
|
169 | 169 | |
170 | 170 | def full_clean(self): |
171 | 171 | """ |
172 | | Cleans all of self.data and populates self.__errors and self.cleaned_data. |
| 172 | Cleans all of self.data and populates self._errors and |
| 173 | self.cleaned_data. |
173 | 174 | """ |
174 | 175 | errors = ErrorDict() |
175 | 176 | if not self.is_bound: # Stop further processing. |
176 | | self.__errors = errors |
| 177 | self._errors = errors |
177 | 178 | return |
178 | 179 | self.cleaned_data = {} |
179 | 180 | for name, field in self.fields.items(): |
… |
… |
|
195 | 196 | errors[NON_FIELD_ERRORS] = e.messages |
196 | 197 | if errors: |
197 | 198 | delattr(self, 'cleaned_data') |
198 | | self.__errors = errors |
| 199 | self._errors = errors |
199 | 200 | |
200 | 201 | def clean(self): |
201 | 202 | """ |