Changeset 4284
- Timestamp:
- 01/04/07 00:25:53 (2 years ago)
- Files:
-
- django/trunk/django/newforms/forms.py (modified) (3 diffs)
- django/trunk/tests/regressiontests/forms/tests.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/newforms/forms.py
r4265 r4284 45 45 self.auto_id = auto_id 46 46 self.prefix = prefix 47 self.clean_data = None # Stores the data after clean() has been called.48 47 self.__errors = None # Stores the errors after clean() has been called. 49 48 … … 138 137 Cleans all of self.data and populates self.__errors and self.clean_data. 139 138 """ 140 self.clean_data = {}141 139 errors = ErrorDict() 142 140 if self.ignore_errors: # Stop further processing. 143 141 self.__errors = errors 144 142 return 143 self.clean_data = {} 145 144 for name, field in self.fields.items(): 146 145 # value_from_datadict() gets the data from the dictionary. … … 161 160 errors[NON_FIELD_ERRORS] = e.messages 162 161 if errors: 163 self.clean_data = None162 delattr(self, 'clean_data') 164 163 self.__errors = errors 165 164 django/trunk/tests/regressiontests/forms/tests.py
r4272 r4284 1545 1545 >>> p.is_valid() 1546 1546 False 1547 >>> p.clean_data 1548 Traceback (most recent call last): 1549 ... 1550 AttributeError: 'birthday' object has no attribute 'clean_data' 1547 1551 >>> print p 1548 1552 <tr><th><label for="id_first_name">First name:</label></th><td><ul class="errorlist"><li>This field is required.</li></ul><input type="text" name="first_name" id="id_first_name" /></td></tr> … … 1573 1577 >>> p.is_valid() 1574 1578 False 1579 >>> p.clean_data 1580 Traceback (most recent call last): 1581 ... 1582 AttributeError: 'birthday' object has no attribute 'clean_data' 1575 1583 >>> print p 1576 1584 <tr><th><label for="id_first_name">First name:</label></th><td><input type="text" name="first_name" id="id_first_name" /></td></tr> … … 1612 1620 * This field is required. 1613 1621 >>> p.clean_data 1614 >>> repr(p.clean_data) 1615 'None' 1622 Traceback (most recent call last): 1623 ... 1624 AttributeError: 'birthday' object has no attribute 'clean_data' 1616 1625 >>> p['first_name'].errors 1617 1626 [u'This field is required.']
