-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -33,10 +33,11 @@ | |||
from django.views.generic import View | ||||
from edx_django_utils.monitoring import set_custom_attribute, set_custom_attributes_for_course_key | ||||
from ipware.ip import get_client_ip | ||||
from lms.djangoapps.static_template_view.views import render_500 | ||||
from markupsafe import escape | ||||
from opaque_keys import InvalidKeyError | ||||
from opaque_keys.edx.keys import CourseKey, UsageKey | ||||
from openedx_filters.learning.filters import CourseAboutRenderStarted | ||||
from openedx_filters.learning.filters import CourseAboutRenderStarted, RenderXBlockStarted | ||||
from requests.exceptions import ConnectionError, Timeout # pylint: disable=redefined-builtin | ||||
from pytz import UTC | ||||
from rest_framework import status | ||||
|
@@ -1669,7 +1670,18 @@ def render_xblock(request, usage_key_string, check_if_enrolled=True, disable_sta | |||
|
||||
**optimization_flags, | ||||
} | ||||
return render_to_response('courseware/courseware-chromeless.html', context) | ||||
|
||||
try: | ||||
# .. filter_implemented_name: RenderXBlockStarted | ||||
# .. filter_type: org.openedx.learning.xblock.render.started.v1 | ||||
context, student_view_context = RenderXBlockStarted.run_filter( | ||||
context=context, student_view_context=student_view_context | ||||
) | ||||
except RenderXBlockStarted.PreventXBlockBlockRender as exc: | ||||
log.info("Skipping rendering block %s. Reason: %s", usage_key_string, exc.message) | ||||
return render_500() | ||||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
nsprenkle
Author
Contributor
|
response = exc.response |
2 comments
on commit 28e1601
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at
edx-platform/xmodule/vertical_block.py
Line 123 in f3413fd
child, child_block_context = VerticalBlockChildRenderStarted.run_filter( |
edx-platform/xmodule/vertical_block.py
Line 173 in f3413fd
_, fragment, context, view = VerticalBlockRenderCompleted.run_filter( |
RenderXBlockCompleted
or move the block before the fragment is rendered as to be able to affect the student_view_context
before is passed to fragment renderization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at
edx-platform/xmodule/vertical_block.py
Line 123 in f3413fd
child, child_block_context = VerticalBlockChildRenderStarted.run_filter( vs
edx-platform/xmodule/vertical_block.py
Line 173 in f3413fd
_, fragment, context, view = VerticalBlockRenderCompleted.run_filter( , to maintain consistency you would want to call this
RenderXBlockCompleted
or move the block before the fragment is rendered as to be able to affect thestudent_view_context
before is passed to fragment renderization.
Per your suggestion, refactored to move to before rendering of fragment.
I think you should pipe something in the exception to the rendering. As a consumer of this filter you might choose not to use it, but it is customary to allow it.