[biplan] fix bugs

This commit is contained in:
Bezleputh 2014-05-16 15:19:49 +02:00
commit 51ddda4bf9
4 changed files with 19 additions and 6 deletions

View file

@ -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)