Opened 11 years ago

Closed 11 years ago

#5167 closed (invalid)

UnicodeDecodeError in MultiWidget

Reported by: Artyom Gnilov <boobsd@…> Owned by: Adrian Holovaty
Component: Forms Version: master
Severity: Keywords: unicode
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Code of my ComplexMultiWidget:

class ComplexMultiWidget(MultiWidget):
    def __init__(self, widgets=None, attrs=None):
        if not widgets:
            widgets = (TextInput(), TextInput())
        super(ComplexMultiWidget, self).__init__(widgets, attrs)
    def decompress(self, value):
        if value:
            return value
        return [None for a in range(len(self.widgets))]
    def format_output(self, rendered_widgets):
        return _('to').join(rendered_widgets)




Traceback (most recent call last):
File "/usr/local/lib/python2.4/site-packages/django/template/" in render_node
  754. result = node.render(context)
File "/usr/local/lib/python2.4/site-packages/django/template/" in render
  228. return self.nodelist_true.render(context)
File "/usr/local/lib/python2.4/site-packages/django/template/" in render
  739. return ''.join([force_unicode(b) for b in bits])
File "/usr/local/lib/python2.4/site-packages/django/utils/" in force_unicode
  37. s = unicode(s)
File "/usr/local/lib/python2.4/site-packages/django/newforms/" in __unicode__
  77. return self.as_table()
File "/usr/local/lib/python2.4/site-packages/django/newforms/" in as_table
  155. return self._html_output(u'<tr><th>%(label)s</th><td>%(errors)s%(field)s%(help_text)s</td></tr>', u'<tr><td colspan="2">%s</td></tr>', '</td></tr>', u'<br />%s', False)
File "/usr/local/lib/python2.4/site-packages/django/newforms/" in _html_output
  140. output.append(normal_row % {'errors': force_unicode(bf_errors), 'label': force_unicode(label), 'field': unicode(bf), 'help_text': help_text})
File "/usr/local/lib/python2.4/site-packages/django/newforms/" in __unicode__
  237. return self.as_widget()
File "/usr/local/lib/python2.4/site-packages/django/newforms/" in as_widget
  265. return widget.render(self.html_name, data, attrs=attrs)
File "/usr/local/lib/python2.4/site-packages/django/newforms/" in render
  378. return self.format_output(output)
File "/root/projects/auto/../auto/ad/" in format_output
  29. return _('to').join(rendered_widgets)

  UnicodeDecodeError at /catalog/search/simple/
  'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)

Change History (1)

comment:1 Changed 11 years ago by boobsd@…

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top