ensure start/stop are datetime before access to .hour tls-sprint
authorsylvain.thenault@logilab.fr
Thu, 14 May 2009 08:35:19 +0200
branchtls-sprint
changeset 1799 183acfaa3cde
parent 1798 cc86fe8efaaa
child 1800 05c36cf3c813
child 1832 3384264d25cc
ensure start/stop are datetime before access to .hour
web/views/calendar.py
--- a/web/views/calendar.py	Wed May 13 19:51:30 2009 +0200
+++ b/web/views/calendar.py	Thu May 14 08:35:19 2009 +0200
@@ -11,7 +11,7 @@
 
 from cubicweb.interfaces import ICalendarable
 from cubicweb.selectors import implements
-from cubicweb.utils import strptime, date_range, todate
+from cubicweb.utils import strptime, date_range, todate, todatetime
 from cubicweb.view import EntityView
 from cubicweb.web import ajax_replace_url
 
@@ -116,7 +116,7 @@
 
     def in_working_hours(self):
         """predicate returning True is the task is in working hours"""
-        if self.task.start.hour > 7 and self.task.stop.hour < 20:
+        if todatetime(self.task.start).hour > 7 and todatetime(self.task.stop).hour < 20:
             return True
         return False