Commit 28bc6a38 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Jérome Perrin

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

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