Ticket #6283: bug-6283.patch
File bug-6283.patch, 1.8 KB (added by , 17 years ago) |
---|
-
forms.py
5 5 from copy import deepcopy 6 6 7 7 from django.utils.datastructures import SortedDict 8 from django.utils.html import escape8 from django.utils.html import conditional_escape 9 9 from django.utils.encoding import StrAndUnicode, smart_unicode, force_unicode 10 10 from django.utils.safestring import mark_safe 11 11 … … 126 126 output, hidden_fields = [], [] 127 127 for name, field in self.fields.items(): 128 128 bf = BoundField(self, field, name) 129 bf_errors = self.error_class([ escape(error) for error in bf.errors]) # Escape and cache in local variable.129 bf_errors = self.error_class([conditional_escape(error) for error in bf.errors]) # Escape and cache in local variable. 130 130 if bf.is_hidden: 131 131 if bf_errors: 132 132 top_errors.extend([u'(Hidden field %s) %s' % (name, force_unicode(e)) for e in bf_errors]) … … 135 135 if errors_on_separate_row and bf_errors: 136 136 output.append(error_row % force_unicode(bf_errors)) 137 137 if bf.label: 138 label = escape(force_unicode(bf.label))138 label = conditional_escape(force_unicode(bf.label)) 139 139 # Only add the suffix if the label does not end in 140 140 # punctuation. 141 141 if self.label_suffix: … … 323 323 324 324 If attrs are given, they're used as HTML attributes on the <label> tag. 325 325 """ 326 contents = contents or escape(self.label)326 contents = contents or conditional_escape(self.label) 327 327 widget = self.field.widget 328 328 id_ = widget.attrs.get('id') or self.auto_id 329 329 if id_: