Ticket #17533: boundfield.patch
File boundfield.patch, 1.6 KB (added by , 13 years ago) |
---|
-
.py
old new 69 69 # class is different than Form. See the comments by the Form class for more 70 70 # information. Any improvements to the form API should be made to *this* 71 71 # class, not to the Form class. 72 _bound_field_class = BoundField 72 73 def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None, 73 74 initial=None, error_class=ErrorList, label_suffix=':', 74 75 empty_permitted=False): … … 96 97 97 98 def __iter__(self): 98 99 for name, field in self.fields.items(): 99 yield BoundField(self, field, name)100 yield self._bound_field_class(self, field, name) 100 101 101 102 def __getitem__(self, name): 102 103 "Returns a BoundField with the given name." … … 104 105 field = self.fields[name] 105 106 except KeyError: 106 107 raise KeyError('Key %r not found in Form' % name) 107 return BoundField(self, field, name)108 return self._bound_field_class(self, field, name) 108 109 109 110 def _get_errors(self): 110 111 "Returns an ErrorDict for the data provided for the form" … … 142 143 143 144 for name, field in self.fields.items(): 144 145 html_class_attr = '' 145 bf = BoundField(self, field, name)146 bf = self._bound_field_class(self, field, name) 146 147 bf_errors = self.error_class([conditional_escape(error) for error in bf.errors]) # Escape and cache in local variable. 147 148 if bf.is_hidden: 148 149 if bf_errors: