replace cmp_start_date method
This commit is contained in:
parent
edc49f59b2
commit
36f919e8fa
2 changed files with 3 additions and 19 deletions
|
|
@ -28,14 +28,6 @@ from.calendar import BiplanCalendarEvent
|
|||
__all__ = ['BiplanBackend']
|
||||
|
||||
|
||||
def cmp_start_date(p1, p2):
|
||||
if p1.start_date == p2.start_date:
|
||||
return 0
|
||||
if p1.start_date > p2.start_date:
|
||||
return 1
|
||||
return -1
|
||||
|
||||
|
||||
class BiplanBackend(BaseBackend, ICapCalendarEvent):
|
||||
NAME = 'biplan'
|
||||
DESCRIPTION = u'lebiplan.org website'
|
||||
|
|
@ -62,13 +54,13 @@ class BiplanBackend(BaseBackend, ICapCalendarEvent):
|
|||
query.categories)
|
||||
|
||||
items = list(itertools.chain(concert_events, theatre_events))
|
||||
items.sort(cmp=cmp_start_date)
|
||||
items.sort(key=lambda o:o.start_date)
|
||||
return items
|
||||
|
||||
def list_events(self, date_from, date_to=None):
|
||||
items = list(itertools.chain(self.browser.list_events_concert(date_from, date_to),
|
||||
self.browser.list_events_theatre(date_from, date_to)))
|
||||
items.sort(cmp=cmp_start_date)
|
||||
items.sort(key=lambda o:o.start_date)
|
||||
return items
|
||||
|
||||
def get_event(self, _id):
|
||||
|
|
|
|||
|
|
@ -28,14 +28,6 @@ from .calendar import SensCritiquenCalendarEvent
|
|||
__all__ = ['SenscritiqueBackend']
|
||||
|
||||
|
||||
def cmp_start_date(p1, p2):
|
||||
if p1.start_date == p2.start_date:
|
||||
return 0
|
||||
if p1.start_date > p2.start_date:
|
||||
return 1
|
||||
return -1
|
||||
|
||||
|
||||
class SenscritiqueBackend(BaseBackend, ICapCalendarEvent):
|
||||
NAME = 'senscritique'
|
||||
DESCRIPTION = u'senscritique website'
|
||||
|
|
@ -119,7 +111,7 @@ class SenscritiqueBackend(BaseBackend, ICapCalendarEvent):
|
|||
for item in self.browser.list_events(date_from, date_to, package, channels):
|
||||
items.append(item)
|
||||
|
||||
items.sort(cmp=cmp_start_date)
|
||||
items.sort(key=lambda o:o.start_date)
|
||||
return items
|
||||
|
||||
def get_event(self, _id):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue