Commit 113a5a3f authored by Jérome Perrin's avatar Jérome Perrin

crm,Formulator: fix handling of non breakable space unicode characters

This was not correct on python3
parent 6ee95ea3
Pipeline #38780 failed with stage
in 0 seconds
......@@ -38,6 +38,7 @@ getPreferredCategoryChildItemListMethodId.
# - all resource child must be properly indented
# It is much simpler if only "empty_category=False" case is handled.
from Products.ERP5Type.Cache import CachingMethod
from Products.ERP5Type.Utils import bytes2str
from AccessControl import getSecurityManager
from six.moves import range
portal = context.getPortalObject()
......@@ -58,7 +59,7 @@ if indent_category == indent_resource == compact == None:
accessor_id = 'getCompactTranslatedTitle' if compact else 'getTranslatedTitle'
def getResourceItemList():
INDENT = portal_preferences.getPreferredWhitespaceNumberForChildItemIndentation() * '\xc2\xa0' # UTF-8 Non-breaking space
INDENT = portal_preferences.getPreferredWhitespaceNumberForChildItemIndentation() * bytes2str(b'\xc2\xa0') # UTF-8 Non-breaking space
RESOURCE_INDENT = INDENT if indent_resource else ''
getResourceTitle = lambda resource, category, depth: RESOURCE_INDENT * depth + getattr(resource, accessor_id)()
if indent_category:
......
......@@ -12,7 +12,7 @@ from six.moves.urllib.parse import urljoin
from lxml import etree
from lxml.etree import Element, SubElement
from lxml.builder import ElementMaker
from Products.ERP5Type.Utils import unicode2str, str2unicode
from Products.ERP5Type.Utils import bytes2str, unicode2str, str2unicode
import re
import sys
import six
......@@ -1145,7 +1145,7 @@ class MultiItemsWidget(ItemsWidget):
d[item_value] = item_text
result = []
for e in value:
result.append(d[e].replace('\xc2\xa0', ''))
result.append(d[e].replace(bytes2str(b'\xc2\xa0'), ''))
return result
def render_odg(self, field, value, as_string, ooo_builder, REQUEST,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment