Ticket #6283: bug-6283.patch

File bug-6283.patch, 1.8 KB (added by Paul Hummer, 17 years ago)
  • forms.py

     
    55from copy import deepcopy
    66
    77from django.utils.datastructures import SortedDict
    8 from django.utils.html import escape
     8from django.utils.html import conditional_escape
    99from django.utils.encoding import StrAndUnicode, smart_unicode, force_unicode
    1010from django.utils.safestring import mark_safe
    1111
     
    126126        output, hidden_fields = [], []
    127127        for name, field in self.fields.items():
    128128            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.
    130130            if bf.is_hidden:
    131131                if bf_errors:
    132132                    top_errors.extend([u'(Hidden field %s) %s' % (name, force_unicode(e)) for e in bf_errors])
     
    135135                if errors_on_separate_row and bf_errors:
    136136                    output.append(error_row % force_unicode(bf_errors))
    137137                if bf.label:
    138                     label = escape(force_unicode(bf.label))
     138                    label = conditional_escape(force_unicode(bf.label))
    139139                    # Only add the suffix if the label does not end in
    140140                    # punctuation.
    141141                    if self.label_suffix:
     
    323323
    324324        If attrs are given, they're used as HTML attributes on the <label> tag.
    325325        """
    326         contents = contents or escape(self.label)
     326        contents = contents or conditional_escape(self.label)
    327327        widget = self.field.widget
    328328        id_ = widget.attrs.get('id') or self.auto_id
    329329        if id_:
Back to Top