def get_occurences(self): rrules = self.context.recurrence starts = IRecurringSequence(RRuleICal(self.context.start(), rrules)) ends = IRecurringSequence(RRuleICal(self.context.end(), rrules)) events = map( lambda start,end:dict( start_date = ulocalized_time(start, False, time_only=None, context=self.context), end_date = ulocalized_time(end, False, time_only=None, context=self.context), start_time = ulocalized_time(start, False, time_only=True, context=self.context), end_time = ulocalized_time(end, False, time_only=True, context=self.context), same_day = event_util.isSameDay(self.context), same_time = event_util.isSameTime(self.context), ), starts, ends ) """ from Products.CMFCore.utils import getToolByName cat = getToolByName(self, 'portal_catalog') events = None cat_item = cat.searchResults(**{'UID':self.context.UID()}) if cat_item: events = map( lambda start,end:dict( start_date = ulocalized_time(start, False, time_only=None, context=self.context), end_date = ulocalized_time(end, False, time_only=None, context=self.context), start_time = ulocalized_time(start, False, time_only=True, context=self.context), end_time = ulocalized_time(end, False, time_only=True, context=self.context), same_day = event_util.isSameDay(self.context), same_time = event_util.isSameTime(self.context), ), cat.getIndexDataForRID(cat_item[0].getRID())['start'], cat.getIndexDataForRID(cat_item[0].getRID())['end'] ) """ return events
def testIsSameDayFailing(self): event = self._makeOne('2000/10/12 06:00:00', '2000/10/13 18:00:00') self.assertEqual(event_util.isSameDay(event), False)
def testIsSameDay(self): event = self._makeOne('2000/10/12 06:00:00', '2000/10/12 18:00:00') self.assertEqual(event_util.isSameDay(event), True)