Ticket #4593: unicode.newforms.c.patch

File unicode.newforms.c.patch, 1.3 KB (added by Bjorn Swift <bjorn.swift@…>, 17 years ago)

Encode label in label_tag and help_text in _html_output using smart_unicode

  • forms.py

     
    66
    77from django.utils.datastructures import SortedDict
    88from django.utils.html import escape
    9 from django.utils.encoding import StrAndUnicode
     9from django.utils.encoding import StrAndUnicode, smart_unicode
    1010
    1111from fields import Field
    1212from widgets import TextInput, Textarea
     
    133133                else:
    134134                    label = ''
    135135                if field.help_text:
    136                     help_text = help_text_html % field.help_text
     136                    help_text = help_text_html % smart_unicode(escape(field.help_text))
    137137                else:
    138138                    help_text = u''
    139139                output.append(normal_row % {'errors': bf_errors, 'label': label, 'field': unicode(bf), 'help_text': help_text})
     
    300300        id_ = widget.attrs.get('id') or self.auto_id
    301301        if id_:
    302302            attrs = attrs and flatatt(attrs) or ''
    303             contents = '<label for="%s"%s>%s</label>' % (widget.id_for_label(id_), attrs, contents)
     303            contents = '<label for="%s"%s>%s</label>' % (widget.id_for_label(id_), attrs, smart_unicode(contents))
    304304        return contents
    305305
    306306    def _is_hidden(self):
Back to Top