Ticket #10447 (closed Bug: fixed)

Opened 5 years ago

Last modified 5 years ago

User prefs forms don't allow Unicode characters

Reported by: esteele Owned by:
Priority: minor Milestone: 4.0
Component: General Version:
Keywords: zope Cc: khink, sunew

Description

(Splitting from #9898)

When editing userdata with non-ascii chars in the full name, a UnicodeDecodeError happens when visiting @@personal-information:

It is appearing after the refactoring:

"add views to replace personalize_form, split up into @@personal-preferences, @@personal-information and @@change-password. [khink, kcleong]"

2010-02-24 19:14:02 ERROR Zope.SiteErrorLog 1267035242.840.792154370906 http://localhost:8880/site3/@@personal-information
Traceback (innermost last):
  Module ZPublisher.Publish, line 127, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module Products.PDBDebugMode.pdbzope.runcall, line 60, in pdb_runcall
  Module ZPublisher.Publish, line 47, in call_object
  Module zope.formlib.form, line 786, in __call__
  Module plone.app.users.browser.account, line 65, in render
  Module Products.Five.browser.pagetemplatefile, line 60, in __call__
  Module zope.pagetemplate.pagetemplate, line 115, in pt_render
   - Warning: Macro expansion failed
   - Warning: <type 'exceptions.NameError'>: name 'getmacro' is not defined
  Module zope.tal.talinterpreter, line 271, in __call__
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 888, in do_useMacro
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 533, in do_optTag_tal
  Module zope.tal.talinterpreter, line 518, in do_optTag
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 531, in do_optTag_tal
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 531, in do_optTag_tal
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 531, in do_optTag_tal
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 533, in do_optTag_tal
  Module zope.tal.talinterpreter, line 522, in do_optTag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 946, in do_defineSlot
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 888, in do_useMacro
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 533, in do_optTag_tal
  Module zope.tal.talinterpreter, line 518, in do_optTag
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 858, in do_defineMacro
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 852, in do_condition
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 821, in do_loop_tal
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 533, in do_optTag_tal
  Module zope.tal.talinterpreter, line 518, in do_optTag
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 742, in do_insertStructure_tal
  Module Products.PageTemplates.Expressions, line 220, in evaluateStructure
  Module zope.tales.tales, line 696, in evaluate
   - URL: /work/saxo2/buildout_tr2.1/src/plone.app.users/plone/app/users/browser/account-panel-bare.pt
   - Line 151, Column 28
   - Expression: <PathExpr standard:u'widget'>
   - Names:
      {'args': (),
       'container': <PloneSite at /site3>,
       'context': <PloneSite at /site3>,
       'default': <object object at 0xb7e6f5e0>,
       'here': <PloneSite at /site3>,
       'loop': {},
       'nothing': None,
       'options': {},
       'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0xdba6f8c>,
       'request': <HTTPRequest, URL=http://localhost:8880/site3/@@personal-information>,
       'root': <Application at >,
       'template': <Products.Five.browser.pagetemplatefile.ViewPageTemplateFile object at 0xdd9c88c>,
       'traverse_subpath': [],
       'user': <PloneUser 'test1'>,
       'view': <Products.Five.metaclass.UserDataPanel object at 0xdd48dac>,
       'views': <Products.Five.browser.pagetemplatefile.ViewMapper object at 0xdd9cc2c>}
  Module zope.tales.expressions, line 217, in __call__
  Module Products.PageTemplates.Expressions, line 157, in _eval
  Module Products.PageTemplates.Expressions, line 119, in render
  Module zope.app.form.browser.textwidgets, line 136, in __call__
  Module zope.app.form.browser.widget, line 537, in renderElement
  Module zope.app.form.browser.widget, line 522, in renderTag
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 7: ordinal not in range(128)
> /work/saxo2/buildout_tr2.1/eggs/zope.app.form-3.8.1-py2.6.egg/zope/app/form/browser/widget.py(522)renderTag()
-> attr_list.append(u'%s=%s' % (key, quoteattr(unicode(value))))
(Pdb) l
517  	                    "Passing None as an attribute value will be disallowed "
518  	                    "starting in Zope 3.3."
519  	                    % key,
520  	                    DeprecationWarning, stacklevel=2)
521  	                value = key
522  ->	            attr_list.append(u'%s=%s' % (key, quoteattr(unicode(value))))
523  	
524  	    if attr_list:
525  	        attr_str = u" ".join(attr_list)
526  	        return u"<%s %s%s" % (tag, attr_str, extra)
527  	    else:
(Pdb) key
'value'
(Pdb) value
'Sune Br\xc3\xb8ndum W\xc3\xb8ller1'
(Pdb) 

Change History

comment:1 Changed 5 years ago by dunlapm

  • Keywords zope added

comment:2 Changed 5 years ago by esteele

The basic issue here is that PropertySheets return values as unicode, PlonePAS (see  http://dev.plone.org/collective/browser/Products.PlonePAS/trunk/Products/PlonePAS/tools/memberdata.py#L292) then encodes it with the default site encoding. The form widget then tries to decode it as ascii.

comment:3 Changed 5 years ago by esteele

  • Status changed from new to closed
  • Resolution set to fixed

(In [36382]) Handle encoded strings returned by PlonePAS. Fixes #10447

comment:4 Changed 3 years ago by davisagli

  • Cc khink, sunew added; khink sunew removed
  • Component changed from Infrastructure to General
Note: See TracTickets for help on using tickets.