def _render_get_lesson_detail(request, lesson): try: workflow, created = _ensure_workflow(request, lesson) except ModuleVersion.DoesNotExist: return HttpResponseServerError('initial_json asks for missing module') except ValueError as err: return HttpResponseServerError('initial_json has invalid params: ' + str(err)) modules = visible_modules(request) init_state = make_init_state(request, workflow=workflow, modules=modules) init_state['lessonData'] = LessonSerializer(lesson).data # If we just initialized this workflow, start fetches and render if created: _queue_workflow_updates(workflow) if lesson.course: course_slug = lesson.course.slug else: course_slug = 'None' server.utils.log_user_event_from_request( request, 'Start lesson in course %s' % (course_slug) ) return TemplateResponse(request, 'workflow.html', {'initState': init_state})
def _render_get_lesson_detail(request, lesson): try: workflow, created = _ensure_workflow(request, lesson) except KeyError as err: return HttpResponseServerError( "initial_json asks for missing module: %s" % str(err)) except ValueError as err: return HttpResponseServerError("initial_json has invalid params: " + str(err)) modules = visible_modules(request) init_state = make_init_state(request, workflow=workflow, modules=modules) init_state["lessonData"] = jsonize_lesson(lesson) # If we just initialized this workflow, start fetches and render if created: _queue_workflow_updates(workflow) if lesson.course: course_slug = lesson.course.slug else: course_slug = "None" server.utils.log_user_event_from_request( request, "Start lesson in course %s" % (course_slug)) return TemplateResponse(request, "workflow.html", {"initState": init_state})