def schedule_ics(request, conference, mode='conference'): if mode == 'my-schedule': if not request.user.is_authenticated(): raise http.Http404() uid = request.user.id else: uid = None from p3.utils import conference2ical cal = conference2ical(conference, user=uid, abstract='abstract' in request.GET) return http.HttpResponse(list(cal.encode()), content_type='text/calendar')