The VideoBlock `handle_ajax` is allowing NaN values for speed key
and causing videos to not load. Also added a data migration to fix
the data for learners.
PROD-1148
* Workaround the error in find_question_label.
This is a temporary log, which will give us information and unblock the course team.
PROD-1326
* raise exception after logging it.
This is a helpful class when running an experiment, to help
bucket users and keep track of which enrollments to consider
as part of the experiment.
AA-53
Block Structures were meant to be gathered using the LMS process,
as it's meant to be an optimized store for the LMS to use. But
there's an argument to be made for at least the Collect side of
the Collect + Transform could be a Studio concern, because it
explicitly needs to avoid user-awareness.
In either event, collect() was broken on devstack before this
commit because Studio's runtime does not permit handler_url
invocation on "thirdparty" XBlocks. Since VideoBlock is not
really third-party (and it's questionable whether there's any
benefit to making the distinction these days), I'm just making
this change to allow Studio to run collect() without error in
the Studio process. This will fix devstack, which does not
properly route these collect() calls to the LMS process (because
celery runs in-proc by default).
Right now the units of a public course are hidden if there is at least a graded activity in them. This is done due to a change(69eeca61d8) that was done before the implementation of public_view mechanism for unenrolled users.
Since we use public_view now and by default it restricts the unit rendering for anonymous users we do not need to limit the access at this way for anonymous users.
Currently, video is moving one second ahead or behind on each right
and left arrow key respectively.In order to make it compliant with
the industry standards like Youtube,its step is adjusted to five
seconds.
PROD-159
- added more default options to pytest calls in setup.cfg and pytest.ini files.
- pytest-json-report's plugin name in pluggy has changed, so added option for multiple names
removed extras
fixed initial state of transcript
Fixed js tests
fixed js tests
created and fixed tests
Updated Trascript functionality
updated v name
fixed spacing
Updating to the current highest number instead of making it the default
which is highest know by the language. This is beacuse when we update
between python versions if there is a new proctocol version, we don't
want that to cause cache thrashing as we try to load things from the
various caches. We can get into a situation where new machines pickle
things with a newer versions of the procotocl, put them in the cache and
then break older machines that don't know about the new protocol
version.
Fixed the most frequently occurring deprecation warnings, which were causing over half of the 34,140 deprecation warnings raised during the unit tests:
* `Use of .. or absolute path in a resource path is not allowed and will raise exceptions in a future release` - most of these were due to a single mis-configured resource path with a leading slash.
* `count is deprecated. Use Collection.count_documents instead.` - I added a handful of simple workarounds for this pymongo deprecation that shouldn't increase the query counts
Also did some cleanup of unused code in pavelib after the recent split of the new `i18n_compilejs` command from `i18n_dummy`. (This had caused a diff-quality failure on the first commit.)
If an error occurs while rendering an xmodule, the LMS chokes with the
following error if accessed by a non admin user.
In the admin user case the existing line that registers ErrorDescriptor
ensures that everything works. But for the non admin case we need this
additional directive.
Traceback (most recent call last):
File "/openedx/edx-platform/lms/djangoapps/courseware/views/index.py", line 153, in get
return self.render(request)
File "/openedx/edx-platform/lms/djangoapps/courseware/views/index.py", line 217, in render
return render_to_response('courseware/courseware.html', self._create_courseware_context(request))
File "/openedx/edx-platform/lms/djangoapps/courseware/views/index.py", line 468, in _create_courseware_context
courseware_context['fragment'] = self.section.render(self.view, section_context)
File "/usr/local/lib/python2.7/site-packages/xblock/core.py", line 202, in render
return self.runtime.render(self, view, context)
File "/openedx/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1914, in render
return self.__getattr__('render')(block, view_name, context)
File "/openedx/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1335, in render
return super(MetricsMixin, self).render(block, view_name, context=context)
File "/usr/local/lib/python2.7/site-packages/xblock/runtime.py", line 831, in render
frag = view_fn(context)
File "/openedx/edx-platform/common/lib/xmodule/xmodule/seq_module.py", line 262, in student_view
return self._student_or_public_view(context, prereq_met, prereq_meta_info, banner_text)
File "/openedx/edx-platform/common/lib/xmodule/xmodule/seq_module.py", line 343, in _student_or_public_view
items = self._render_student_view_for_items(context, display_items, fragment, view) if prereq_met else []
File "/openedx/edx-platform/common/lib/xmodule/xmodule/seq_module.py", line 485, in _render_student_view_for_items
rendered_item = item.render(view, context)
File "/usr/local/lib/python2.7/site-packages/xblock/core.py", line 202, in render
return self.runtime.render(self, view, context)
File "/openedx/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1914, in render
return self.__getattr__('render')(block, view_name, context)
File "/openedx/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1335, in render
return super(MetricsMixin, self).render(block, view_name, context=context)
File "/usr/local/lib/python2.7/site-packages/xblock/runtime.py", line 831, in render
frag = view_fn(context)
File "/openedx/edx-platform/common/lib/xmodule/xmodule/vertical_block.py", line 118, in student_view
return self._student_or_public_view(context, STUDENT_VIEW)
File "/openedx/edx-platform/common/lib/xmodule/xmodule/vertical_block.py", line 85, in _student_or_public_view
rendered_child = child.render(view, child_block_context)
File "/usr/local/lib/python2.7/site-packages/xblock/core.py", line 202, in render
return self.runtime.render(self, view, context)
File "/openedx/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1914, in render
return self.__getattr__('render')(block, view_name, context)
File "/openedx/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1335, in render
return super(MetricsMixin, self).render(block, view_name, context=context)
File "/usr/local/lib/python2.7/site-packages/xblock/runtime.py", line 831, in render
frag = view_fn(context)
File "/openedx/edx-platform/common/lib/xmodule/xmodule/library_content_module.py", line 314, in student_view
rendered_child = displayable.render(STUDENT_VIEW, child_context)
File "/usr/local/lib/python2.7/site-packages/xblock/core.py", line 202, in render
return self.runtime.render(self, view, context)
File "/openedx/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1914, in render
return self.__getattr__('render')(block, view_name, context)
File "/openedx/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1335, in render
return super(MetricsMixin, self).render(block, view_name, context=context)
File "/usr/local/lib/python2.7/site-packages/xblock/runtime.py", line 835, in render
updated_frag = self.wrap_xblock(block, view_name, frag, context)
File "/openedx/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1287, in wrap_xblock
frag = wrapper(block, view, frag, context)
File "/openedx/edx-platform/openedx/core/lib/xblock_utils/__init__.py", line 155, in wrap_xblock
add_webpack_to_fragment(frag, class_name)
File "/openedx/edx-platform/common/lib/xmodule/xmodule/util/xmodule_django.py", line 28, in add_webpack_to_fragment
for chunk in webpack_loader.utils.get_files(bundle_name, extension, config):
File "/usr/local/lib/python2.7/site-packages/webpack_loader/utils.py", line 31, in get_files
return list(_get_bundle(bundle_name, extension, config))
File "/usr/local/lib/python2.7/site-packages/webpack_loader/utils.py", line 23, in _get_bundle
bundle = get_loader(config).get_bundle(bundle_name)
File "/usr/local/lib/python2.7/site-packages/webpack_loader/loader.py", line 83, in get_bundle
raise WebpackBundleLookupError('Cannot resolve bundle {0}.'.format(bundle_name))
WebpackBundleLookupError: Cannot resolve bundle NonStaffErrorModule.
[TNL-7051] Clicking a video XBlock's fullscreen button now takes the video fullscreen instead of full window.
Gracefully fallback to full window if fullscreen apis are absent
The Video Player XBlock will sometimes make API calls to /couses/yt_video_metadata, a REST API endpoint that in turn loads video metadata from YouTube using the configured settings.YOUTUBE_API_KEY.
However, in the Blockstore-based XBlock runtime, we are running XBlocks in a secure sandbox, and the user's browser cannot pass session cookies when calling REST API endpoints. So currently, the video XBlock tries to request YouTube metadata from that API endpoint, but it fails if run within such a sandbox.
The existing API also doesn't work for anonymous users (users who are allowed to see video XBlocks but who have not logged in to an LMS user account).
This commit updates the Video XBlock so that it can use a handler to load the data from YouTube instead of a generic REST API. This works well in the new runtime, because it has code to support calling handlers within the sandbox, including by anonymous users.
I also fixed a bug where on a default devstack, the endpoint will try calling YouTube using PUT_YOUR_API_KEY_HERE as an API key, and get a "bad request" error from YouTube.
The code could be re-organized by moving things around, but I've left everything as-is for now to keep the diff as small as possible.
This fixes a bug that causes the video XBlock parsing to break in the new XBlock runtime if:
* the html5_sources field is set, and
* the download_video field is not set
The error is:
File "/edx/app/edxapp/edx-platform/openedx/core/djangoapps/xblock/rest_api/views.py", line 52, in render_block_view
block = load_block(usage_key, request.user)
File "/edx/app/edxapp/edx-platform/openedx/core/djangoapps/xblock/api.py", line 84, in load_block
return runtime.get_block(usage_key)
File "/edx/app/edxapp/edx-platform/openedx/core/djangoapps/xblock/runtime/blockstore_runtime.py", line 70, in get_block
block = block_class.parse_xml_new_runtime(xml_node, runtime=self, keys=keys)
File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/video_module/video_module.py", line 620, in parse_xml_new_runtime
setattr(video_block, key, cls.fields[key].from_json(val))
KeyError: 'source'
The reason for the error is that parse_video_xml() will sometimes return a 'source' attribute in its field_data return value, even though source is not a video field (anymore). This then causes an error when trying to look up cls.fields['source']
A workaround in the meantime is to add download_video="false" to the OLX.
* Added pytest-json-report plugin
- modifying app-opts in setup.cfg
- adding hook to all conftest.py files in repo
- setting report to be saved to test_root/log/warnings.json
- Writing custom logic to save json report to avoid overwrite if pytest called twice
This was created to allow us to easily parse through test warnings in jenkins
This adds request caching to the following places:
* course expiration wrapper (displayed in Units)
* offer banner generation (displayed in Units)
* get_enrollment
* user_by_anonymous_id
* youtube_disabled_for_course
On a sample course with edx-val enabled, this reduced the queries
for a large sequence from 450 to 155.