aboutsummaryrefslogtreecommitdiff
path: root/feeds.py
diff options
context:
space:
mode:
authorAlban Gruin2017-11-01 15:20:55 +0100
committerAlban Gruin2017-11-01 15:20:55 +0100
commit2d68777e50e261cb793186321947b677ed9de692 (patch)
treef0ff34041d5eaf7606c372d370dfbd13f3cae4e1 /feeds.py
parent912f3cca24da9d870aa191348fef901adcd55b7d (diff)
Correction des crashes provoqués lors de la génération des ICS
lorsque le type d’un cours est nul.
Diffstat (limited to 'feeds.py')
-rw-r--r--feeds.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/feeds.py b/feeds.py
index 66be12e..aced5e6 100644
--- a/feeds.py
+++ b/feeds.py
@@ -75,6 +75,11 @@ class IcalFeed(Feed):
def item_link(self, item):
return ""
+ def item_summary(self, item):
+ if item.type is not None:
+ return item.name + " (" + item.type + ")"
+ return item.name
+
def items(self, obj):
return Course.objects.get_courses_for_group(obj)
@@ -83,7 +88,7 @@ class IcalFeed(Feed):
"dtstart": item.begin,
"dtend": item.end,
"dtstamp": item.last_update,
- "summary": item.name + " (" + item.type + ")",
+ "summary": self.item_summary(item),
"location": format_rooms(item.rooms.all())}