From a17c97420479b2d29a59458e716dc07e18a07fe4 Mon Sep 17 00:00:00 2001 From: farhan Date: Tue, 31 Mar 2026 23:22:40 +0500 Subject: [PATCH 1/2] test: test commit --- .github/workflows/unit-tests.yml | 1 + requirements/edx/base.txt | 2 +- requirements/edx/development.txt | 2 +- requirements/edx/doc.txt | 2 +- requirements/edx/testing.txt | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 7b7b14a43e88..a5ad848a26c1 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -20,6 +20,7 @@ jobs: name: ${{ matrix.shard_name }}(py=${{ matrix.python-version }},dj=${{ matrix.django-version }},mongo=${{ matrix.mongo-version }}) runs-on: ${{ matrix.os-version }} strategy: + fail-fast: false matrix: python-version: - "3.12" diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index e89bbb77d151..3213ed16561e 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -1273,7 +1273,7 @@ wrapt==2.1.2 # via # -r requirements/edx/kernel.in # xblocks-contrib -xblock[django]==5.3.0 +xblock[django]==git+https://github.com/openedx/xblock.git@farhan/test-video-block#egg=xblock # via # -r requirements/edx/kernel.in # acid-xblock diff --git a/requirements/edx/development.txt b/requirements/edx/development.txt index 4a9a2d55f155..01c39f10c4b9 100644 --- a/requirements/edx/development.txt +++ b/requirements/edx/development.txt @@ -2291,7 +2291,7 @@ wrapt==2.1.2 # -r requirements/edx/doc.txt # -r requirements/edx/testing.txt # xblocks-contrib -xblock[django]==5.3.0 +xblock[django]==git+https://github.com/openedx/xblock.git@farhan/test-video-block#egg=xblock # via # -r requirements/edx/doc.txt # -r requirements/edx/testing.txt diff --git a/requirements/edx/doc.txt b/requirements/edx/doc.txt index 659b862df2da..3d4e4373473e 100644 --- a/requirements/edx/doc.txt +++ b/requirements/edx/doc.txt @@ -1610,7 +1610,7 @@ wrapt==2.1.2 # via # -r requirements/edx/base.txt # xblocks-contrib -xblock[django]==5.3.0 +xblock[django]==git+https://github.com/openedx/xblock.git@farhan/test-video-block#egg=xblock # via # -r requirements/edx/base.txt # acid-xblock diff --git a/requirements/edx/testing.txt b/requirements/edx/testing.txt index 5fa000d059f7..1927c303dfc1 100644 --- a/requirements/edx/testing.txt +++ b/requirements/edx/testing.txt @@ -1705,7 +1705,7 @@ wrapt==2.1.2 # via # -r requirements/edx/base.txt # xblocks-contrib -xblock[django]==5.3.0 +xblock[django]==git+https://github.com/openedx/xblock.git@farhan/test-video-block#egg=xblock # via # -r requirements/edx/base.txt # acid-xblock From 3715c742cf176f6c8c3d954817461cfc63353038 Mon Sep 17 00:00:00 2001 From: farhan Date: Tue, 31 Mar 2026 23:22:56 +0500 Subject: [PATCH 2/2] fix: fix runtime fixes --- cms/djangoapps/contentstore/helpers.py | 6 +++--- .../contentstore/rest_api/v1/views/course_index.py | 6 +++--- cms/djangoapps/contentstore/utils.py | 6 +++--- cms/djangoapps/contentstore/views/preview.py | 12 ++++++------ .../xblock_storage_handlers/xblock_helpers.py | 2 +- common/djangoapps/edxmako/template.py | 1 + openedx/core/djangoapps/video_config/services.py | 8 ++++---- openedx/core/djangolib/js_utils.py | 1 + openedx/core/lib/xblock_utils/__init__.py | 2 +- xmodule/studio_editable.py | 4 ++-- 10 files changed, 25 insertions(+), 23 deletions(-) diff --git a/cms/djangoapps/contentstore/helpers.py b/cms/djangoapps/contentstore/helpers.py index 9bfab1f1f385..ba79ec9f911c 100644 --- a/cms/djangoapps/contentstore/helpers.py +++ b/cms/djangoapps/contentstore/helpers.py @@ -82,10 +82,10 @@ def is_unit(xblock, parent_xblock=None): Returns true if the specified xblock is a vertical that is treated as a unit. A unit is a vertical that is a direct child of a sequential (aka a subsection). """ - if xblock.category == 'vertical': + if xblock.scope_ids.block_type == 'vertical': if parent_xblock is None: parent_xblock = get_parent_xblock(xblock) - parent_category = parent_xblock.category if parent_xblock else None + parent_category = parent_xblock.scope_ids.block_type if parent_xblock else None return parent_category == 'sequential' return False @@ -117,7 +117,7 @@ def xblock_has_own_studio_page(xblock, parent_xblock=None): - a direct child of a unit 3. XBlocks that support children """ - category = xblock.category + category = xblock.scope_ids.block_type if is_unit(xblock, parent_xblock): return True diff --git a/cms/djangoapps/contentstore/rest_api/v1/views/course_index.py b/cms/djangoapps/contentstore/rest_api/v1/views/course_index.py index 42b5b1e9d78d..58238f9b03f4 100644 --- a/cms/djangoapps/contentstore/rest_api/v1/views/course_index.py +++ b/cms/djangoapps/contentstore/rest_api/v1/views/course_index.py @@ -255,7 +255,7 @@ def get(self, request: Request, usage_key_string: str): with modulestore().bulk_operations(usage_key.course_key): # load course once to reuse it for user_partitions query - course = modulestore().get_course(current_xblock.location.course_key) + course = modulestore().get_course(current_xblock.context_key) children = [] if current_xblock.has_children: for child in current_xblock.children: @@ -269,8 +269,8 @@ def get(self, request: Request, usage_key_string: str): children.append({ "xblock": child_info, "name": child_info.display_name_with_default, - "block_id": child_info.location, - "block_type": child_info.location.block_type, + "block_id": child_info.usage_key, + "block_type": child_info.usage_key.block_type, "user_partition_info": user_partition_info, "user_partitions": user_partitions, "upstream_link": ( diff --git a/cms/djangoapps/contentstore/utils.py b/cms/djangoapps/contentstore/utils.py index f40fad42152c..e55a451ef9e5 100644 --- a/cms/djangoapps/contentstore/utils.py +++ b/cms/djangoapps/contentstore/utils.py @@ -813,12 +813,12 @@ def get_user_partition_info(xblock, schemes=None, course=None): ] """ - course = course or modulestore().get_course(xblock.location.course_key) + course = course or modulestore().get_course(xblock.context_key) if course is None: log.warning( "Could not find course %s to retrieve user partition information", - xblock.location.course_key + xblock.context_key ) return [] @@ -2376,7 +2376,7 @@ def get_xblock_render_context(request, block): "reorderable_items": set(), "paging": None, "force_render": None, - "item_url": "/container/{block.location}", + "item_url": "/container/{block.usage_key}", "tags_count_map": {}, } diff --git a/cms/djangoapps/contentstore/views/preview.py b/cms/djangoapps/contentstore/views/preview.py index 6600430a7a89..fc5b56420523 100644 --- a/cms/djangoapps/contentstore/views/preview.py +++ b/cms/djangoapps/contentstore/views/preview.py @@ -162,8 +162,8 @@ def _prepare_runtime_for_preview(request, block): block: An XBlock """ - course_id = block.location.course_key - display_name_only = (block.category == 'static_tab') + course_id = block.usage_key.course_key + display_name_only = (block.scope_ids.block_type == 'static_tab') wrappers = [ # This wrapper wraps the block in the template specified above @@ -298,7 +298,7 @@ def _is_xblock_reorderable(xblock, context): otherwise returns false. """ try: - return xblock.location in context['reorderable_items'] + return xblock.usage_key in context['reorderable_items'] except KeyError: return False @@ -313,12 +313,12 @@ def _studio_wrap_xblock(xblock, view, frag, context, display_name_only=False): # Only add the Studio wrapper when on the container page. The "Pages" page will remain as is for now. if not context.get('is_pages_view', None) and view in PREVIEW_VIEWS: root_xblock = context.get('root_xblock') - is_root = root_xblock and xblock.location == root_xblock.location + is_root = root_xblock and xblock.usage_key == root_xblock.usage_key is_reorderable = _is_xblock_reorderable(xblock, context) selected_groups_label = get_visibility_partition_info(xblock)['selected_groups_label'] if selected_groups_label: selected_groups_label = _('Access restricted to: {list_of_groups}').format(list_of_groups=selected_groups_label) # lint-amnesty, pylint: disable=line-too-long - course = modulestore().get_course(xblock.location.course_key) + course = modulestore().get_course(xblock.context_key) can_edit = context.get('can_edit', True) can_add = context.get('can_add', True) @@ -344,7 +344,7 @@ def _studio_wrap_xblock(xblock, view, frag, context, display_name_only=False): tags_count_map = context.get('tags_count_map') tags_count = 0 if tags_count_map: - tags_count = tags_count_map.get(str(xblock.location), 0) + tags_count = tags_count_map.get(str(xblock.usage_key), 0) template_context = { 'xblock_context': context, 'xblock': xblock, diff --git a/cms/djangoapps/contentstore/xblock_storage_handlers/xblock_helpers.py b/cms/djangoapps/contentstore/xblock_storage_handlers/xblock_helpers.py index 82ed7297d5af..6dd74a1bb75e 100644 --- a/cms/djangoapps/contentstore/xblock_storage_handlers/xblock_helpers.py +++ b/cms/djangoapps/contentstore/xblock_storage_handlers/xblock_helpers.py @@ -35,7 +35,7 @@ def get_tags_count(xblock: XBlock, include_children=False) -> dict[str, int]: if include_children: children = xblock.get_children() - child_usage_keys = [str(child.location) for child in children] + child_usage_keys = [str(child.usage_key) for child in children] query_list.extend(child_usage_keys) tags_count_query = ",".join(query_list) diff --git a/common/djangoapps/edxmako/template.py b/common/djangoapps/edxmako/template.py index 855a2714b865..744370932474 100644 --- a/common/djangoapps/edxmako/template.py +++ b/common/djangoapps/edxmako/template.py @@ -79,6 +79,7 @@ def render(self, context=None, request=None): self._add_core_context(context_dictionary) self._evaluate_lazy_csrf_tokens(context_dictionary) + print(f"Farhan here: context_dictionary: {context_dictionary}") return self.mako_template.render_unicode(**context_dictionary) @staticmethod diff --git a/openedx/core/djangoapps/video_config/services.py b/openedx/core/djangoapps/video_config/services.py index 5e72f8babb9e..a0493c848fac 100644 --- a/openedx/core/djangoapps/video_config/services.py +++ b/openedx/core/djangoapps/video_config/services.py @@ -85,10 +85,10 @@ def get_public_sharing_context(self, video_block, course_key: CourseKey) -> dict """ context = {} - if not sharing.is_public_sharing_enabled(video_block.location, video_block.public_access): + if not sharing.is_public_sharing_enabled(video_block.usage_key, video_block.public_access): return context - public_video_url = sharing.get_public_video_url(video_block.location) + public_video_url = sharing.get_public_video_url(video_block.usage_key) context['public_sharing_enabled'] = True context['public_video_url'] = public_video_url @@ -192,7 +192,7 @@ def available_translations( try: # for bumper videos, transcripts are stored in content store only if is_bumper: - get_transcript_for_video(video_block.location, filename, filename, language) + get_transcript_for_video(video_block.usage_key, filename, filename, language) else: get_transcript(video_block, language) except NotFoundError: @@ -325,7 +325,7 @@ def handle_editor_saved( html5_ids = get_html5_ids(video_block.html5_sources) for subs_id in html5_ids: try: - Transcript.asset(video_block.location, subs_id) + Transcript.asset(video_block.usage_key, subs_id) except NotFoundError: # If a transcript does not not exist with particular html5_id then there is no need to check other # html5_ids because we have to create a new transcript with this missing html5_id by turning on diff --git a/openedx/core/djangolib/js_utils.py b/openedx/core/djangolib/js_utils.py index 115419d1c67b..92a669d9e5dc 100644 --- a/openedx/core/djangolib/js_utils.py +++ b/openedx/core/djangolib/js_utils.py @@ -104,6 +104,7 @@ def js_escaped_string(string_for_js): unicode. Returns empty string if argument is None. """ + if string_for_js is None: string_for_js = "" string_for_js = decode.utf8(string_for_js) diff --git a/openedx/core/lib/xblock_utils/__init__.py b/openedx/core/lib/xblock_utils/__init__.py index d398a159f998..bea5c03949a6 100644 --- a/openedx/core/lib/xblock_utils/__init__.py +++ b/openedx/core/lib/xblock_utils/__init__.py @@ -144,7 +144,7 @@ def wrap_xblock( template_context = { 'content': block.display_name if display_name_only else frag.content, 'classes': css_classes, - 'display_name': block.display_name_with_default_escaped, # xss-lint: disable=python-deprecated-display-name + 'display_name': block.display_name_with_default, # xss-lint: disable=python-deprecated-display-name 'data_attributes': ' '.join(f'data-{markupsafe.escape(key)}="{markupsafe.escape(value)}"' for key, value in data.items()), } diff --git a/xmodule/studio_editable.py b/xmodule/studio_editable.py index d190c966cab8..05de7b58c5ba 100644 --- a/xmodule/studio_editable.py +++ b/xmodule/studio_editable.py @@ -25,13 +25,13 @@ def render_children(self, context, fragment, can_reorder=False, can_add=False): for child in self.get_children(): # pylint: disable=no-member if can_reorder: - context['reorderable_items'].add(child.location) + context['reorderable_items'].add(child.usage_key) context['can_add'] = can_add rendered_child = child.render(StudioEditableBlock.get_preview_view_name(child), context) fragment.add_fragment_resources(rendered_child) contents.append({ - 'id': str(child.location), + 'id': str(child.usage_key), 'content': rendered_child.content })