Commit 9a322c0a authored by Jérome Perrin's avatar Jérome Perrin

ListBox: keep order of selection domain dict with an OrderedDict

revealed by test_getHateoas_selection_compatibility with PYTHONHASHSEED 763

also change testHalJsonStyle to be deterministic when testing domain
tree and domain path, revealed by test_getHateoas_selection_compatibility
with PYTHONHASHSEED 191
parent 67b35ddc
......@@ -2361,7 +2361,7 @@ return context.getPortalObject().portal_catalog(portal_type='Foo', sort_on=[('id
query='id:"foo"',
list_method='Test_listCatalog',
select_list=['title', 'uid'],
selection_domain=json.dumps({'foo_domain': 'a/a1', 'foo_category': 'a/a2'}),
selection_domain=json.dumps({'foo_domain': 'a/a1', 'foo_category': 'a/a2'}, sort_keys=True),
relative_url='foo_module',
form_relative_url='portal_skins/erp5_ui_test/FooModule_viewFooList/listbox',
default_param_json='eyJwb3J0YWxfdHlwZSI6IFsiRm9vIl0sICJpZ25vcmVfdW5rbm93bl9jb2x1bW5zIjogdHJ1ZX0=',
......@@ -2384,8 +2384,8 @@ return context.getPortalObject().portal_catalog(portal_type='Foo', sort_on=[('id
})
self.assertEqual(selection.getSortOrder(), [('title', 'DESC')])
self.assertEqual(selection.columns, [('title', 'Title')])
self.assertEqual(selection.getDomainPath(), ['foo_domain', 'foo_category'])
self.assertEqual(selection.getDomainList(), ['foo_domain/a', 'foo_domain/a/a1', 'foo_category/a', 'foo_category/a/a2'])
self.assertEqual(selection.getDomainPath(), ['foo_category', 'foo_domain'])
self.assertEqual(selection.getDomainList(), ['foo_category/a', 'foo_category/a/a2', 'foo_domain/a', 'foo_domain/a/a1',])
self.assertEqual(selection.flat_list_mode, 0)
self.assertEqual(selection.domain_tree_mode, 1)
self.assertEqual(selection.report_tree_mode, 0)
......
......@@ -27,6 +27,7 @@ from __future__ import absolute_import
#
##############################################################################
import collections
from six.moves import xrange
from six import string_types as basestring
import sys
......@@ -1412,7 +1413,7 @@ class ListBoxRenderer:
if len(domain_list) > 0:
category_tool = self.getCategoryTool()
domain_tool = self.getDomainTool()
root_dict = {}
root_dict = collections.OrderedDict()
for domain in domain_list:
# XXX workaround for a past bug in Selection
......
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