def test_occurrence_accessor(self): start = self.now end = self.future occ = Occurrence('ignored', start, end) occ = occ.__of__(self.now_event) acc_occ = IEventAccessor(occ) acc_ctx = IEventAccessor(self.now_event) self.assertEqual(acc_occ.start, acc_ctx.start) self.assertEqual(acc_occ.url, 'http://nohost/plone/now/ignored')
def test_occurrence_accessor(self): start = datetime.datetime.today() end = datetime.datetime.today() occ = Occurrence('ignored', start, end) occ = occ.__of__(self.portal['at']) data = IEventAccessor(occ) self.assertNotEqual(data.start, tzdel(self.portal['at'].start_date)) self.assertEqual(start, data.start)
def get_obj(start): if pydt(event_start.replace(microsecond=0)) == start: # If the occurrence date is the same as the event object, the # occurrence is the event itself. return it as such. # Dates from recurrence_sequence_ical are explicitly without # microseconds, while event.start may contain it. So we have to # remove it for a valid comparison. return self.context return Occurrence(id=str(start.date()), start=start, end=start + duration).__of__(self.context)