Commit 9abfdd3c authored by Jérome Perrin's avatar Jérome Perrin Committed by Arnaud Fontaine

SimulationTool: py3

parent 30da6895
......@@ -28,6 +28,7 @@ from __future__ import division
#
##############################################################################
import functools
from past.builtins import cmp
from six import string_types as basestring
from Products.CMFCore.utils import getToolByName
......@@ -1626,7 +1627,7 @@ class SimulationTool(BaseTool):
try:
result = cmp(line_a[key], line_b[key])
except KeyError:
raise Exception('Impossible to sort result since columns sort '
raise ValueError('Impossible to sort result since columns sort '
'happens on are not available in result: %r' % (key, ))
if result:
if not sort_direction.upper().startswith('A'):
......@@ -1637,7 +1638,10 @@ class SimulationTool(BaseTool):
result *= -1
break
return result
sorted_inventory_list.sort(cmp_inventory_line)
if six.PY2:
sorted_inventory_list.sort(cmp_inventory_line)
else:
sorted_inventory_list.sort(key=functools.cmp_to_key(cmp_inventory_line))
# Brain is rebuild properly using tuple not r instance
column_list = first_result._searchable_result_columns()
column_name_list = [x['name'] for x in column_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