Ticket #3947: newforms-unicode.diff

File newforms-unicode.diff, 1.9 KB (added by anonymous, 18 years ago)
  • django/newforms/forms.py

     
    44
    55from django.utils.datastructures import SortedDict, MultiValueDict
    66from django.utils.html import escape
    7 from django.utils.encoding import StrAndUnicode
     7from django.utils.encoding import StrAndUnicode, smart_unicode
    88from fields import Field
    99from widgets import TextInput, Textarea, HiddenInput, MultipleHiddenInput
    1010from util import flatatt, ErrorDict, ErrorList, ValidationError
     
    127127                    help_text = help_text_html % field.help_text
    128128                else:
    129129                    help_text = u''
    130                 output.append(normal_row % {'errors': bf_errors, 'label': label, 'field': unicode(bf), 'help_text': help_text})
     130                output.append(normal_row % {'errors': bf_errors, 'label': smart_unicode(label), 'field': unicode(bf), 'help_text': help_text})
    131131        if top_errors:
    132132            output.insert(0, error_row % top_errors)
    133133        if hidden_fields: # Insert any hidden fields in the last row.
  • django/newforms/widgets.py

     
    162162        for option_value, option_label in chain(self.choices, choices):
    163163            option_value = smart_unicode(option_value)
    164164            selected_html = (option_value == str_value) and u' selected="selected"' or ''
    165             output.append(u'<option value="%s"%s>%s</option>' % (escape(option_value), selected_html, escape(smart_unicode(option_label))))
     165            output.append(u'<option value="%s"%s>%s</option>' % (escape(option_value), selected_html, smart_unicode(escape(option_label))))
    166166        output.append(u'</select>')
    167167        return u'\n'.join(output)
    168168
Back to Top