Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions cms/djangoapps/contentstore/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions cms/djangoapps/contentstore/rest_api/v1/views/course_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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": (
Expand Down
6 changes: 3 additions & 3 deletions cms/djangoapps/contentstore/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 []

Expand Down Expand Up @@ -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": {},
}

Expand Down
12 changes: 6 additions & 6 deletions cms/djangoapps/contentstore/views/preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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)
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions common/djangoapps/edxmako/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions openedx/core/djangoapps/video_config/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions openedx/core/djangolib/js_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion openedx/core/lib/xblock_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
}
Expand Down
2 changes: 1 addition & 1 deletion requirements/edx/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements/edx/development.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements/edx/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements/edx/testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions xmodule/studio_editable.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
})

Expand Down
Loading