Unicode decode error in SequenceWidget

Bug #160925 reported by Sylvain Viollon
2
Affects Status Importance Assigned to Milestone
Zope 3
Won't Fix
Undecided
Unassigned
zope.formlib
Invalid
Undecided
Unassigned

Bug Description

Create the following schema:

class IDataItem(Interface):

    data = TextLine(title=u"Data",
                              required=True)

    other fields ...

class IDataList(Interface):

    all_data = List(title=_(u"All data"),
                   value_type=Object(schema=IDataItem, title=u"Items"))

Create a ListeSequenceWidget in a form, using CustomWidgetFactory(ListSequenceWidget, subwidget=CustomWidgetFactory(ObjectWidget, DataItem)) where DataItem implements IDataItem. Display the form, fill some accented characters, save, redisplay the form, get an UnicodeDecodeError, ascii can't handle ... in the SequenceWidget code. This work perfectly without this complex data structure.

Tried in Zope 2.9.

Revision history for this message
Christian Theune (ctheune) wrote : Re: [Bug 160925] Unicode decode error in SequenceWidget

Hi,

can you please attach a traceback for this error?

Am Donnerstag, den 08.11.2007, 11:06 +0000 schrieb Sylvain Viollon:

> Create a ListeSequenceWidget in a form, using
> CustomWidgetFactory(ListSequenceWidget,
> subwidget=CustomWidgetFactory(ObjectWidget, DataItem)) where DataItem
> implements IDataItem. Display the form, fill some accented characters,
> save, redisplay the form, get an UnicodeDecodeError, ascii can't
> handle
> ... in the SequenceWidget code. This work perfectly without this
> complex
> data structure.
>
> Tried in Zope 2.9.

>
> ** Affects: zope3
> Importance: Undecided
> Status: New
>
--
gocept gmbh & co. kg - forsterstrasse 29 - 06112 halle (saale) - germany
www.gocept.com - <email address hidden> - phone +49 345 122 9889 7 -
fax +49 345 122 9889 1 - zope and plone consulting and development

Revision history for this message
Sylvain Viollon (thefunny) wrote :
Download full text (4.8 KiB)

Traceback, using my real code :

2007-11-08 14:35:06 ERROR Zope.SiteErrorLog http://admin.localhost:8080/cms/sites/zonder-is-gezonder/chemical-bestrijdingsmiddelen/4/write_answers
Traceback (innermost last):
  Module ZPublisher.Publish, line 115, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 41, in call_object
  Module zope.formlib.form, line 770, in __call__
  Module zope.formlib.form, line 764, in render
  Module Shared.DC.Scripts.Bindings, line 311, in __call__
  Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
  Module Products.PageTemplates.PageTemplateFile, line 113, in _exec
  Module Products.PageTemplates.PageTemplate, line 104, in pt_render
   - <ImplicitAcquirerWrapper object at 0xd06678c>
  Module TAL.TALInterpreter, line 238, in __call__
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 749, in do_useMacro
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 457, in do_optTag_tal
  Module TAL.TALInterpreter, line 442, in do_optTag
  Module TAL.TALInterpreter, line 437, in no_tag
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 749, in do_useMacro
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 457, in do_optTag_tal
  Module TAL.TALInterpreter, line 442, in do_optTag
  Module TAL.TALInterpreter, line 437, in no_tag
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 780, in do_defineSlot
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 457, in do_optTag_tal
  Module TAL.TALInterpreter, line 442, in do_optTag
  Module TAL.TALInterpreter, line 437, in no_tag
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 728, in do_defineMacro
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 772, in do_defineSlot
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 457, in do_optTag_tal
  Module TAL.TALInterpreter, line 442, in do_optTag
  Module TAL.TALInterpreter, line 437, in no_tag
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 772, in do_defineSlot
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 728, in do_defineMacro
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 728, in do_defineMacro
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 780, in do_defineSlot
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 457, in do_optTag_tal
  Module TAL.TALInterpreter, line 446, in do_optTag
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 691, in do_loop_tal
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 457, in do_optTag_tal
  Module TAL.TALInterpreter, line 442, in do_optTag
  Module TAL.TALInterpreter, line 437, in no_tag
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 647, in do_ins...

Read more...

Revision history for this message
Sylvain Viollon (thefunny) wrote :

If you check the code of renderElement in zope.app.form.browser.widgets, you can see that it return a unicode string correctly. But some widget didn't use this function (for exemple when they build a table), and do some ''.join() of non-unicode string.

Tres Seaver (tseaver)
Changed in zope3:
status: New → Won't Fix
Revision history for this message
Colin Watson (cjwatson) wrote :

The zope.formlib project on Launchpad has been archived at the request of the Zope developers (see https://answers.launchpad.net/launchpad/+question/683589 and https://answers.launchpad.net/launchpad/+question/685285). If this bug is still relevant, please refile it at https://github.com/zopefoundation/zope.formlib.

Changed in zope.formlib:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.