Skip to content

Commit 06711a5

Browse files
committed
Work around for error in calendars
See #424
1 parent 71cbde9 commit 06711a5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

naucse/views.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,14 +900,19 @@ def course_calendar_ics(course):
900900

901901
logger.error("There was an error rendering url %s for course '%s'", request.path, course.slug)
902902
logger.exception(e)
903-
return render_template(
903+
error_html = render_template(
904904
"error_in_fork.html",
905905
malfunctioning_course=course,
906906
edit_info=get_edit_info(course.edit_path),
907907
faulty_page="calendar",
908908
root_slug=model.meta.slug,
909909
travis_build_id=os.environ.get("TRAVIS_BUILD_ID"),
910910
)
911+
# XXX: Hack for static site generation -- the .ics extension
912+
# means the error page is served as text/calendar. There's
913+
# no good way to make an actual calendar show an error.
914+
# https://github.com/pyvec/naucse.python.cz/issues/424
915+
return Response(error_html, mimetype="text/calendar")
911916
else:
912917
try:
913918
calendar = generate_calendar_ics(course)

0 commit comments

Comments
 (0)