1

应用Plone 安全补丁 20161129后,我们的 PloneFormGen 表单不再起作用,因为它包含变音符号(ä、ö、ß 或 €)。我们使用 PloneFormGen 1.7.20,这是 Plone 4.3.9 的推荐版本。这是堆栈跟踪:

  Module zope.tales.tales, line 696, in evaluate
   - URL: file:/var/plone/buildout-cache/eggs/Products.PloneFormGen-1.7.20-py2.7.egg/Products/PloneFormGen/skins/PloneFormGen/widget_fieldset_start.pt
   - Line 25, Column 10
   - Expression: <PythonExpr widget.Description(here)>
   - Names:
      {'container': <PloneSite at /mysite>,
       'context': <FormFolder at /mysite/mitglied-werden>,
       'desitelt': <object object at 0x7fe244f734b0>,
       'here': <FormFolder at /mysite/mitglied-werden>,
       'loop': {u'field': <Products.PageTemplates.Expressions.PathIterator object at 0x16fe5350>},
       'nothing': None,
       'options': {'args': (),
                   'state': <Products.CMFFormController.ControllerState.ControllerState object at 0x7fe22c676610>},
       'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0x1d61fc00>,
       'request': <HTTPRequest, URL=https://www.example.org/mitglied-werden/fg_base_view_p3>,
       'root': <Application at >,
       'template': <FSControllerPageTemplate at /mysite/fg_base_view_p3 used for /mysite/mitglied-werden>,
       'traverse_subpath': [],
       'user': <PloneUser 'siteb390'>}
  Module Products.PageTemplates.ZRPythonExpr, line 48, in __call__
   - __traceback_info__: widget.Description(here)
  Module PythonExpr, line 1, in <expression>
  Module Products.PloneFormGen.content.field_utils, line 27, in wDescription
  Module zope.i18n, line 107, in translate
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 20: ordinal not in range(128)

删除变音符号后,它又可以工作了,但现在的表格看起来有点不专业。

在网上搜索了一个小时后只是这个错误,我不知道哪个扩展导致这个(PloneFormGen?)导致这个以及如何解决它:-/甚至不知道该往哪个方向看……

4

1 回答 1

3

从 1.7.20 开始,所有 PFG 描述字段都通过翻译机制推送。(请不要问我为什么他们对用户提供的字段这样做,因为描述字段首先不是语言不敏感的。)正如您发现的那样,这对您可以在描述中使用的字母施加了额外的限制.

没有声称这是一个错误修复,但在我的快速试用中,修改了buildout-cache/eggs/Products.PloneFormGen-1.7.20-py2.7.egg/Products/PloneFormGen/content/field_utils.py第 27 行

        if value:
        value = translate(value, context=instance.REQUEST)
        return cgi.escape(value)

    if value:
        value = translate(value.decode('utf-8'), context=instance.REQUEST)
        return cgi.escape(value)

使问题消失。

于 2016-12-05T16:25:58.433 回答