diff --git a/icalexport.py b/icalexport.py index 95dc09763a0b5640fd1171be9f67f3aef4534dfe..8ab175842f0ccc80c3464213a34ff817aeb88027 100644 --- a/icalexport.py +++ b/icalexport.py @@ -9,19 +9,22 @@ def export_lectures(lectures, name): cal.add('version', '1.0') for l in lectures: event = icalendar.Event() - event.add('summary', l['course']['short']+' : '+l['title']) - event.add('description', l['internal']) - event.add('uid', 'lecture_'+str(l['id'])+'@rwth.video') - event.add('comment', l['comment']) + event.add('summary', l['course']['short']+': '+l['title']) + event.add('description', '\n\n'.join([s for s in [ + l['comment'], + l['internal'], + 'Zuständig: '+l['course']['responsible'] if l['course']['responsible'] else '' + ] if s])) + event.add('uid', '%i@rwth.video'%l['id']) event.add('dtstamp', datetime.utcnow()) event.add('categories', l['course']['short']) event.add('dtstart', l['time']) event.add('location', l['place']) event.add('dtend', l['time'] + timedelta(minutes=l['duration'])) cal.add_component(event) - H = Headers() - H.add_header("Content-Disposition", "inline", filename=name) - return Response(cal.to_ical(), mimetype="text/calendar", headers=H) + h = Headers() + h.add_header("Content-Disposition", "inline", filename=name) + return Response(cal.to_ical(), mimetype="text/calendar", headers=h) def calperm(func): @wraps(func)