[biplan] fix bugs
This commit is contained in:
parent
0ff2abb2fd
commit
51ddda4bf9
4 changed files with 19 additions and 6 deletions
|
|
@ -28,6 +28,14 @@ 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'
|
||||
|
|
@ -53,11 +61,15 @@ class BiplanBackend(BaseBackend, ICapCalendarEvent):
|
|||
query.city,
|
||||
query.categories)
|
||||
|
||||
return itertools.chain(concert_events, theatre_events)
|
||||
items = list(itertools.chain(concert_events, theatre_events))
|
||||
items.sort(cmp=cmp_start_date)
|
||||
return items
|
||||
|
||||
def list_events(self, date_from, date_to=None):
|
||||
return itertools.chain(self.browser.list_events_concert(date_from, date_to),
|
||||
self.browser.list_events_theatre(date_from, date_to))
|
||||
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)
|
||||
return items
|
||||
|
||||
def get_event(self, _id):
|
||||
return self.browser.get_event(_id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue