[web] fix CalendarView : both icalendarable.start and icalendarable.stop dates can be None stable
authorKatia Saurfelt <katia.saurfelt@logilab.fr>
Mon, 04 Apr 2011 14:10:52 +0200
branchstable
changeset 7183 5ea2bfd55399
parent 7182 09454384fff8
child 7184 59d953d8694e
child 7185 6e42b595e5df
[web] fix CalendarView : both icalendarable.start and icalendarable.stop dates can be None
web/views/calendar.py
--- a/web/views/calendar.py	Thu Mar 31 14:23:11 2011 +0200
+++ b/web/views/calendar.py	Mon Apr 04 14:10:52 2011 +0200
@@ -229,15 +229,15 @@
         events = []
         for entity in self.cw_rset.entities():
             icalendarable = entity.cw_adapt_to('ICalendarable')
+            if not (icalendarable.start and icalendarable.stop):
+                continue
+            start_date = icalendarable.start or  icalendarable.stop
             event = {'eid': entity.eid,
                      'title': entity.view('calendaritem'),
                      'url': xml_escape(entity.absolute_url()),
                      'className': 'calevent',
                      'description': entity.view('tooltip'),
                      }
-            start_date = icalendarable.start
-            if not start_date:
-                start_date = icalendarable.stop
             event['start'] = start_date.strftime('%Y-%m-%dT%H:%M')
             event['allDay'] = True
             if icalendarable.stop: