plone/plone.app.vocabularies — pull request #2 by miohtama (2012-06-27 14:58:22+00:00)
Title: Fix the issue where non-ASCII workflow titles would cause contentrule… 

If one has non-ASCII characters in workflow transition titles contentrules.xml import will fail.

Content rules import refers to transition titles as Zope 3 vocabulary where values must be unicode. However, the vocabulary generator never decodes the titles. (Not sure if they should be unicode in the first place.... however a lot of Finnish sites have had this problem).

- When contentrules.xml, containing WF state trigger, import is called

- ... it generates a vocab of transition names ...

- ... which causes UnicodeDecodeError in plone.app.vocabularies.workflow

The patch explicitly decodes WF titles as utf-8 if they are not unicode for the vocabulary.

Please review this as I am not sure whether this is the right way to fix the problem. (Not sure if WF titles should be always saved as unicode, but it doesn't seem to be case with portal_workflow editor etc)

Example traceback of failure this patch will fix:

2012-06-27 17:23:07 ERROR Zope.SiteErrorLog 1340806987.350.649260933092 http://localhost:9666/isleofback/portal_quickinstaller/reinstallProducts
Traceback (innermost last):
Module ZPublisher.Publish, line 126, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 46, in call_object
Module , line 6, in reinstallProducts
Module AccessControl.requestmethod, line 70, in _curried
Module Products.CMFQuickInstallerTool.QuickInstallerTool, line 640, in reinstallProducts
Module Products.CMFQuickInstallerTool.QuickInstallerTool, line 580, in installProducts
Module Products.CMFQuickInstallerTool.QuickInstallerTool, line 512, in installProduct
- __traceback_info__: ('isleofback.app',)
Module Products.GenericSetup.tool, line 353, in runAllImportStepsFromProfile
- __traceback_info__: profile-isleofback.app:default
Module Products.GenericSetup.tool, line 1123, in _runImportStepsFromContext
Module Products.GenericSetup.tool, line 1036, in _doRunImportStep
- __traceback_info__: contentrules
Module plone.app.contentrules.exportimport.rules, line 425, in importRules
Module Products.GenericSetup.utils, line 507, in _importBody
Module plone.app.contentrules.exportimport.rules, line 192, in _importNode
Module plone.app.contentrules.exportimport.rules, line 266, in _initRules
Module plone.app.contentrules.exportimport.rules, line 57, in import_element
Module plone.app.contentrules.exportimport.rules, line 88, in import_node
Module zope.schema._field, line 408, in bind
Module zope.schema._field, line 291, in bind
Module Zope2.App.schema, line 33, in get
Module plone.app.vocabularies.workflow, line 182, in __call__
Module zope.i18nmessageid.message, line 140, in __call__
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)