def __init__(self, calendar_path): with open(calendar_path, 'r', encoding='UTF-8') as cal_file: try: cal_content = cal_file.readlines() self.calendar = iCalendar(cal_content) except Exception as e: raise InvalidCalendarFileException(message=str(e))
def __init__(self, calendar_path): with open(calendar_path, 'r') as cal_file: try: cal_content = cal_file.readlines() self.calendar = iCalendar(cal_content) except Exception: raise InvalidCalendarFileException()
def cal(request): duration = timedelta(hours=3) cal = iCalendar() events = Event.objects.all() for event in events: if event.event_date is None or not event.status == u"Prêt": continue # TODO : add url time = arrow.get(event.event_date.replace(tzinfo=None), 'Europe/Brussels') e = iEvent(name=event.name.replace(',', '\,'), begin=time, duration=duration, location=event.place.replace(',', '\,')) cal.events.append(e) return HttpResponse(str(cal), content_type="text/calendar")
def __init__(self, calendar_path): with open(calendar_path, 'r') as cal_file: cal_content = cal_file.readlines() self.calendar = iCalendar(cal_content)
def test_one_entity_one_attrib(self): ical = ics.iCalendar(source='assets/tests/one_entity_one_attr.ics') print(ical.parsed) self.assertEqual(ical.parsed['root']['VCALENDAR']['HELLO'], 'WORLD')