Commit e7335b91 authored by Jérome Perrin's avatar Jérome Perrin

fixup! *: use key instead of cmp to sort

parent baadac86
...@@ -24,8 +24,5 @@ else: ...@@ -24,8 +24,5 @@ else:
or career.getStopDate() < to_date : or career.getStopDate() < to_date :
career_list.append(career) career_list.append(career)
def date_cmp(a, b): career_list.sort(key=lambda a: a.getStartDate())
return cmp(a.getStartDate(), b.getStartDate())
career_list.sort(date_cmp)
return career_list return career_list
...@@ -88,11 +88,7 @@ for portal_type in portal_type_list: ...@@ -88,11 +88,7 @@ for portal_type in portal_type_list:
obj['total'] = line_counter obj['total'] = line_counter
append(obj) append(obj)
# sort lines line_list.sort(key=lambda a:a['document_type'])
def cmpType(a, b):
return cmp(a['document_type'], b['document_type'])
line_list.sort(cmpType)
# build stat line # build stat line
obj = Object(uid="new_") obj = Object(uid="new_")
......
...@@ -31,9 +31,6 @@ dest_event_list = portal.portal_catalog(portal_type=event_type_list, default_des ...@@ -31,9 +31,6 @@ dest_event_list = portal.portal_catalog(portal_type=event_type_list, default_des
event_list = list(source_event_list)+list(dest_event_list) event_list = list(source_event_list)+list(dest_event_list)
def sortDate(a, b): event_list.sort(key=lambda a: a.getStartDate())
return cmp(a.getStartDate(), b.getStartDate())
event_list.sort(sortDate)
return event_list return event_list
...@@ -23,13 +23,10 @@ full_total_price = 0 ...@@ -23,13 +23,10 @@ full_total_price = 0
worker_column_list = [] worker_column_list = []
source_trade_dict = {} source_trade_dict = {}
def sortMovement(a, b):
return cmp(a.getRelativeUrl(), b.getRelativeUrl())
movement_type_list = context.getPortalMovementTypeList() movement_type_list = context.getPortalMovementTypeList()
line_list = [x for x in context.getIndexableChildValueList() if x.getPortalType() in \ line_list = [x for x in context.getIndexableChildValueList() if x.getPortalType() in \
movement_type_list] movement_type_list]
line_list.sort(sortMovement) line_list.sort(key=lambda line: line.getRelativeUrl())
order_type_list = context.getPortalOrderTypeList() order_type_list = context.getPortalOrderTypeList()
def getMovementTitle(movement): def getMovementTitle(movement):
......
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