Commit 110810fa authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Jérome Perrin

fixup! fixup! py2/py3: dict_key does not have sort().

parent 03a07403
......@@ -68,6 +68,7 @@ for item in item_list:
else:
sub_field_dict[item_key]['title'] = base_category
sub_field_values = sub_field_dict.values()
sub_field_values.sort(key=lambda d:d['int_index'])
return sub_field_values
return sorted(
sub_field_dict.values(),
key=lambda d: d['int_index']
)
......@@ -182,10 +182,7 @@ if len(listbox_id_list):
for listbox_id in listbox_id_list:
listbox_line_list = []
listbox = kw[listbox_id]
listbox_keys = listbox.keys()
listbox_keys.sort()
for key in listbox_keys:
listbox_line = listbox[key]
for key, listbox_line in sorted(six.iteritems(listbox)):
listbox_line['listbox_key'] = key
listbox_line_list.append(listbox_line)
listbox_line_list = tuple(listbox_line_list)
......
......@@ -41,9 +41,7 @@ if depth == 0:
category_list = []
#i = 1
month_dict_list = month_dict.keys()
month_dict_list.sort()
for year, month in month_dict_list:
for year, month in sorted(month_dict.keys()):
category_list.append(here.getObject().asContext(title="%s - %s" % (year, month),
string_index="%s-%s" % (year, month),
))
......
......@@ -26,8 +26,6 @@
#
##############################################################################
from Products.ERP5Type.Utils import ensure_list
import zope.interface
from AccessControl import ClassSecurityInfo
......@@ -319,8 +317,7 @@ class ImmobilisableItem(Item, Amount):
Returns a list of dictionaries representing immobilisation periods for the object
from_date is included, to_date is excluded
"""
kw_key_list = kw.keys()
kw_key_list.sort()
kw_key_list = sorted(kw.keys())
if kw_key_list.count('immo_cache_dict'):
kw_key_list.remove('immo_cache_dict')
immo_cache_dict = kw.get('immo_cache_dict', {'period':{},
......@@ -780,8 +777,7 @@ class ImmobilisableItem(Item, Amount):
"""
if at_date is None:
at_date = DateTime()
kw_key_list = ensure_list(kw.keys())
kw_key_list.sort()
kw_key_list = sorted(kw.keys())
if kw_key_list.count('immo_cache_dict'):
kw_key_list.remove('immo_cache_dict')
......
......@@ -41,9 +41,7 @@ from OFS.Image import Pdata, Image as OFSImage
from DateTime import DateTime
def makeSortedTuple(kw):
items = kw.items()
items.sort()
return tuple(items)
return tuple(sorted(kw.items()))
def hashPdataObject(pdata_object):
"""Pdata objects are iterable, use this feature strongly
......
......@@ -132,8 +132,7 @@ if len(listbox_id_list):
for listbox_id in listbox_id_list:
listbox_line_list = []
listbox = kw[listbox_id]
for key, value in sorted(six.iteritems(listbox)):
listbox_line = value
for key, listbox_line in sorted(six.iteritems(listbox)):
listbox_line['listbox_key'] = key
listbox_line_list.append(listbox_line)
listbox_line_list = tuple(listbox_line_list)
......
......@@ -332,9 +332,7 @@ class Predicate(XMLObject):
criterion_dict[p].property = p
criterion_dict[p].min = self._range_criterion.get(p, (None, None))[0]
criterion_dict[p].max = self._range_criterion.get(p, (None, None))[1]
criterion_list = criterion_dict.values()
criterion_list.sort()
return criterion_list
return sorted(criterion_dict.values())
security.declareProtected( Permissions.ModifyPortalContent, 'setCriterion' )
def setCriterion(self, property, identity=None, min=None, max=None, **kw):
......
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