Commit 2c04ccbb authored by Jérome Perrin's avatar Jérome Perrin

listbox: py3

parent 50e52f01
...@@ -40,6 +40,7 @@ from Products.ERP5Type.Globals import get_request ...@@ -40,6 +40,7 @@ from Products.ERP5Type.Globals import get_request
from Products.ERP5Type.tests.utils import createZODBPythonScript from Products.ERP5Type.tests.utils import createZODBPythonScript
from ZPublisher.HTTPRequest import FileUpload from ZPublisher.HTTPRequest import FileUpload
from six.moves import cStringIO as StringIO from six.moves import cStringIO as StringIO
import six
from Products.ERP5Form.Selection import Selection from Products.ERP5Form.Selection import Selection
from Products.Formulator.TALESField import TALESMethod from Products.Formulator.TALESField import TALESMethod
from Products.ERP5Form.ListBox import ListBoxHTMLRenderer from Products.ERP5Form.ListBox import ListBoxHTMLRenderer
...@@ -252,12 +253,16 @@ class TestListBox(ERP5TypeTestCase): ...@@ -252,12 +253,16 @@ class TestListBox(ERP5TypeTestCase):
# We create a script to use as a list method # We create a script to use as a list method
list_method_id = 'ListBox_ParametersListMethod' list_method_id = 'ListBox_ParametersListMethod'
if six.PY2:
list_method_code = """return [context.asContext(alternate_title = u'\xe9lisa'.encode('utf8'))]"""
else:
list_method_code = """return [context.asContext(alternate_title = '\xe9lisa')]"""
createZODBPythonScript( createZODBPythonScript(
portal.portal_skins.custom, portal.portal_skins.custom,
list_method_id, list_method_id,
'selection=None, **kw', 'selection=None, **kw',
"""return [context.asContext(alternate_title = u'\xe9lisa'.encode('utf8'))]""") list_method_code,
)
# set the listbox to use this as list method # set the listbox to use this as list method
listbox = portal.FooModule_viewFooList.listbox listbox = portal.FooModule_viewFooList.listbox
listbox.ListBox_setPropertyList( listbox.ListBox_setPropertyList(
......
...@@ -1254,7 +1254,7 @@ class ListBoxRenderer: ...@@ -1254,7 +1254,7 @@ class ListBoxRenderer:
params.setdefault('meta_type', meta_type_list) params.setdefault('meta_type', meta_type_list)
# Remove FileUpload parameters # Remove FileUpload parameters
for k, v in params.items(): for k, v in list(params.items()):
if k == "listbox": if k == "listbox":
# listbox can also contain useless parameters # listbox can also contain useless parameters
new_list = [] new_list = []
......
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