diff options
author | Alban Gruin | 2017-09-05 21:40:08 +0200 |
---|---|---|
committer | Alban Gruin | 2017-09-05 21:40:08 +0200 |
commit | 492da9dc027a42384b286593c61e6951089bc013 (patch) | |
tree | f8cc7c7b63197e614ed9001d88f2a3588987f3f3 | |
parent | 88197b09b47911d38b7ca372d5d25e0f13d3ea10 (diff) |
Correction de détails
-rw-r--r-- | feeds.py | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -20,7 +20,7 @@ from django.utils.feedgenerator import SyndicationFeed from icalendar import Calendar, Event -class IcalFeed(SyndicationFeed): +class IcalFeedGenerator(SyndicationFeed): content_type = "text/calendar; charset=utf-8" __ical_names = {"name": "summary", "notes": "description", @@ -32,12 +32,14 @@ class IcalFeed(SyndicationFeed): calendar = Calendar() calendar.add("version", "2.0") - write_events(calendar) + self.write_events(calendar) outfile.write(calendar.to_ical()) def write_events(self, calendar): - for item in items: + print(self.items) + for item in self.items: event = Event() - for key, value in item.items(): - if key in __ical_names: - event.add(__ical_names[key], value) + for key, value in self.__ical_names.items(): + if item.get(key) is not None: + event.add(value, item[key]) + calendar.add_component(event) |