def display_event_schedule_xcal(identifier): event = get_published_event_or_abort(identifier) if not event.has_session_speakers: abort(404) accepted_sessions_count = get_count(DataGetter.get_sessions(event.id)) if accepted_sessions_count == 0 or not event.schedule_published_on: abort(404) response = make_response(XCalExporter.export(event.id)) response.headers["Content-Type"] = "application/xml" return response
def export_xcal_task(event_id): event = DataGetter.get_event(event_id) try: os.mkdir(app.config['TEMP_UPLOADS_FOLDER']) except OSError as exc: if exc.errno != errno.EEXIST: raise exc filename = "xcal.xcs" file_path = app.config['TEMP_UPLOADS_FOLDER'] + "/" + filename with open(file_path, "w") as temp_file: temp_file.write(XCalExporter.export(event_id)) xcal_file = UploadedFile(file_path=file_path, filename=filename) event.xcal_url = upload(xcal_file, UPLOAD_PATHS['exports']['xcal'].format(event_id=event_id)) save_to_db(event)
def export_xcal_task(event_id): event = DataGetter.get_event(event_id) try: os.mkdir(app.config['TEMP_UPLOADS_FOLDER']) except OSError as exc: if exc.errno != errno.EEXIST: raise exc filename = "xcal.xcs" file_path = app.config['TEMP_UPLOADS_FOLDER'] + "/" + filename with open(file_path, "w") as temp_file: temp_file.write(XCalExporter.export(event_id)) xcal_file = UploadedFile(file_path=file_path, filename=filename) event.xcal_url = upload( xcal_file, UPLOAD_PATHS['exports']['xcal'].format(event_id=event_id)) save_to_db(event)
def xcal_export_view(event_id): response = make_response(XCalExporter.export(event_id)) response.headers["Content-Type"] = "text/calendar" response.headers[ "Content-Disposition"] = "attachment; filename=calendar.xcs" return response
def xcal_export_view(event_id): response = make_response(XCalExporter.export(event_id)) response.headers["Content-Type"] = "text/calendar" response.headers["Content-Disposition"] = "attachment; filename=calendar.xcs" return response