Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7f2e68c
refactor: xmodule/annotatable_module.py -> xmodule/annotatable_block.py
0x29a Oct 26, 2022
4c005e8
refactor: xmodule/capa_module.py -> xmodule/capa_block.py
0x29a Oct 26, 2022
7e33dce
refactor: xmodule/conditional_module.py -> xmodule/conditional_block.py
0x29a Oct 26, 2022
0df1411
refactor: xmodule/course_module.py -> xmodule/course_block.py
0x29a Oct 26, 2022
11caff0
refactor: xmodule/editing_module.py -> xmodule/editing_block.py
0x29a Oct 26, 2022
cf47f63
refactor: xmodule/error_module.py -> xmodule/error_block.py
0x29a Oct 26, 2022
4d86185
refactor: xmodule/hidden_module.py -> xmodule/hidden_block.py
0x29a Oct 26, 2022
007e02c
refactor: xmodule/html_module.py -> xmodule/html_block.py
0x29a Oct 26, 2022
e359170
refactor: xmodule/library_content_module.py -> xmodule/library_conten…
0x29a Oct 26, 2022
2779bd2
refactor: xmodule/lti_module.py -> xmodule/lti_block.py
0x29a Oct 26, 2022
57383a2
refactor: xmodule/mako_module.py -> xmodule/mako_block.py
0x29a Oct 26, 2022
71b8350
refactor: xmodule/poll_module.py -> xmodule/poll_block.py
0x29a Oct 26, 2022
4aac963
refactor: xmodule/randomize_module.py -> xmodule/randomize_block.py
0x29a Oct 26, 2022
e443e25
refactor: xmodule/raw_module.py -> xmodule/raw_block.py
0x29a Oct 26, 2022
70019ba
refactor: xmodule/seq_module.py -> xmodule/seq_block.py
0x29a Oct 26, 2022
a2c5e07
refactor: xmodule/template_module.py -> xmodule/template_block.py
0x29a Oct 26, 2022
071b4ba
refactor: xmodule/word_cloud_module.py -> xmodule/word_cloud_block.py
0x29a Oct 26, 2022
7fa5f38
refactor: xmodule/wrapper_module.py -> xmodule/wrapper_block.py
0x29a Oct 26, 2022
685f1cd
refactor: xmodule/xml_module.py -> xmodule/xml_block.py
0x29a Oct 26, 2022
dd9f693
refactor: xmodule/video_module -> xmodule/video_block
0x29a Oct 26, 2022
d3fee38
refactor: xmodule/split_test_module.py -> xmodule/split_test_block.py
0x29a Oct 26, 2022
83396ff
refactor: convert course_module term to course_block
0x29a Oct 27, 2022
eec4965
refactor: update paths in translation files
0x29a Nov 12, 2022
3115db5
feat: implement falling back to HiddenBlock
0x29a Dec 13, 2022
ae1dcbe
refactor: rename HiddenDescriptor to HiddenBlock
Agrendalath Dec 19, 2022
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
2 changes: 1 addition & 1 deletion cms/djangoapps/contentstore/course_group_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from openedx.core.djangoapps.course_groups.partition_scheme import get_cohorted_user_partition
from xmodule.partitions.partitions import MINIMUM_STATIC_PARTITION_ID, ReadOnlyUserPartitionError, UserPartition # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.partitions.partitions_service import get_all_partitions_for_course # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.split_test_module import get_split_user_partitions # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.split_test_block import get_split_user_partitions # lint-amnesty, pylint: disable=wrong-import-order

MINIMUM_GROUP_ID = MINIMUM_STATIC_PARTITION_ID

Expand Down
2 changes: 1 addition & 1 deletion cms/djangoapps/contentstore/course_info_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from django.utils.translation import gettext as _

from openedx.core.lib.xblock_utils import get_course_update_items
from xmodule.html_module import CourseInfoBlock # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.html_block import CourseInfoBlock # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.exceptions import ItemNotFoundError # lint-amnesty, pylint: disable=wrong-import-order

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from cms.djangoapps.contentstore.management.commands.utils import user_from_str
from cms.djangoapps.contentstore.views.course import create_new_course_in_store
from openedx.core.djangoapps.credit.models import CreditProvider
from xmodule.course_module import CourseFields # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.course_block import CourseFields # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.fields import Date # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.exceptions import DuplicateCourseError # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.tabs import CourseTabList # lint-amnesty, pylint: disable=wrong-import-order
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def setUpClass(cls):
ItemFactory.create(
parent=unit,
category="html",
display_name="An HTML Module"
display_name="An HTML Block"
)

def test_end_to_end(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
List,
String,
)
from xmodule.course_module import CourseFields, EmailString
from xmodule.course_block import CourseFields, EmailString
from xmodule.fields import Date

from cms.djangoapps.models.settings.course_metadata import CourseMetadata
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ def get(self, request: Request, course_id: str):
course_key = CourseKey.from_string(course_id)
if not has_studio_read_access(request.user, course_key):
self.permission_denied(request)
course_module = modulestore().get_course(course_key)
course_block = modulestore().get_course(course_key)
return Response(CourseMetadata.fetch_all(
course_module,
course_block,
filter_fields=filter_query_data.cleaned_data['filter_fields'],
))

Expand Down Expand Up @@ -174,6 +174,6 @@ def patch(self, request: Request, course_id: str):
course_key = CourseKey.from_string(course_id)
if not has_studio_write_access(request.user, course_key):
self.permission_denied(request)
course_module = modulestore().get_course(course_key)
updated_data = update_course_advanced_settings(course_module, request.data, request.user)
course_block = modulestore().get_course(course_key)
updated_data = update_course_advanced_settings(course_block, request.data, request.user)
return Response(updated_data)
12 changes: 6 additions & 6 deletions cms/djangoapps/contentstore/rest_api/v0/views/tabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ def get(self, request: Request, course_id: str) -> Response:
if not has_studio_read_access(request.user, course_key):
self.permission_denied(request)

course_module = modulestore().get_course(course_key)
tabs_to_render = get_course_tabs(course_module, request.user)
course_block = modulestore().get_course(course_key)
tabs_to_render = get_course_tabs(course_block, request.user)
return Response(CourseTabSerializer(tabs_to_render, many=True).data)


Expand Down Expand Up @@ -147,12 +147,12 @@ def post(self, request: Request, course_id: str) -> Response:
tab_id_locator = TabIDLocatorSerializer(data=request.query_params)
tab_id_locator.is_valid(raise_exception=True)

course_module = modulestore().get_course(course_key)
course_block = modulestore().get_course(course_key)
serializer = CourseTabUpdateSerializer(data=request.data)
serializer.is_valid(raise_exception=True)

edit_tab_handler(
course_module,
course_block,
{
"tab_id_locator": tab_id_locator.data,
**serializer.data,
Expand Down Expand Up @@ -216,11 +216,11 @@ def post(self, request: Request, course_id: str) -> Response:
if not has_studio_write_access(request.user, course_key):
self.permission_denied(request)

course_module = modulestore().get_course(course_key)
course_block = modulestore().get_course(course_key)
tab_id_locators = TabIDLocatorSerializer(data=request.data, many=True)
tab_id_locators.is_valid(raise_exception=True)
reorder_tabs_handler(
course_module,
course_block,
tab_id_locators.validated_data,
request.user,
)
Expand Down
2 changes: 1 addition & 1 deletion cms/djangoapps/contentstore/rest_api/v1/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from rest_framework import serializers

from xmodule.course_module import get_available_providers
from xmodule.course_block import get_available_providers


class ProctoredExamSettingsSerializer(serializers.Serializer):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def test_403_if_instructor_in_another_course(self):
response = self.make_request()
assert response.status_code == status.HTTP_403_FORBIDDEN

def test_404_no_course_module(self):
def test_404_no_course_block(self):
course_id = 'course-v1:edX+ToyX_Nonexistent_Course+Toy_Course'
self.client.login(username=self.global_staff, password=self.password)
response = self.make_request(course_id=course_id)
Expand Down
24 changes: 12 additions & 12 deletions cms/djangoapps/contentstore/rest_api/v1/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from cms.djangoapps.contentstore.views.course import get_course_and_check_access
from cms.djangoapps.models.settings.course_metadata import CourseMetadata
from xmodule.course_module import get_available_providers # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.course_block import get_available_providers # lint-amnesty, pylint: disable=wrong-import-order
from openedx.core.djangoapps.course_apps.toggles import exams_ida_enabled
from openedx.core.lib.api.view_utils import view_auth_classes
from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order
Expand Down Expand Up @@ -92,8 +92,8 @@ class ProctoredExamSettingsView(APIView):
def get(self, request, course_id):
""" GET handler """
with modulestore().bulk_operations(CourseKey.from_string(course_id)):
course_module = self._get_and_validate_course_access(request.user, course_id)
course_metadata = CourseMetadata().fetch_all(course_module)
course_block = self._get_and_validate_course_access(request.user, course_id)
course_metadata = CourseMetadata().fetch_all(course_block)
proctored_exam_settings = self._get_proctored_exam_setting_values(course_metadata)

data = {}
Expand Down Expand Up @@ -123,8 +123,8 @@ def post(self, request, course_id):
return Response(status=status.HTTP_403_FORBIDDEN)

with modulestore().bulk_operations(CourseKey.from_string(course_id)):
course_module = self._get_and_validate_course_access(request.user, course_id)
course_metadata = CourseMetadata().fetch_all(course_module)
course_block = self._get_and_validate_course_access(request.user, course_id)
course_metadata = CourseMetadata().fetch_all(course_block)

models_to_update = {}
for setting_key, value in exam_config.data.items():
Expand All @@ -133,9 +133,9 @@ def post(self, request, course_id):
models_to_update[setting_key] = copy.deepcopy(model)
models_to_update[setting_key]['value'] = value

# validate data formats and update the course module object
# validate data formats and update the course block object
is_valid, errors, updated_data = CourseMetadata.validate_and_update_from_json(
course_module,
course_block,
models_to_update,
user=request.user,
)
Expand All @@ -148,7 +148,7 @@ def post(self, request, course_id):
)

# save to mongo
modulestore().update_item(course_module, request.user.id)
modulestore().update_item(course_block, request.user.id)

# merge updated settings with all existing settings.
# do this because fields that could not be modified are excluded from the result
Expand All @@ -171,14 +171,14 @@ def _get_and_validate_course_access(user, course_id):
"""
Check if course_id exists and is accessible by the user.

Returns a course_module object
Returns a course_block object
"""
course_key = CourseKey.from_string(course_id)
course_module = get_course_and_check_access(course_key, user)
course_block = get_course_and_check_access(course_key, user)

if not course_module:
if not course_block:
raise NotFound(
f'Course with course_id {course_id} does not exist.'
)

return course_module
return course_block
10 changes: 5 additions & 5 deletions cms/djangoapps/contentstore/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
from openedx.core.djangoapps.embargo.models import CountryAccessRule, RestrictedCourse
from openedx.core.lib.extract_tar import safetar_extractall
from xmodule.contentstore.django import contentstore # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.course_module import CourseFields # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.course_block import CourseFields # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.exceptions import SerializationError # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore import COURSE_ROOT, LIBRARY_ROOT # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order
Expand Down Expand Up @@ -167,7 +167,7 @@ def rerun_course(source_course_key_string, destination_course_key_string, user_i
# cleanup any remnants of the course
modulestore().delete_course(destination_course_key, user_id)
except ItemNotFoundError:
# it's possible there was an error even before the course module was created
# it's possible there was an error even before the course block was created
pass

return "exception: " + str(exc)
Expand Down Expand Up @@ -335,21 +335,21 @@ def export_olx(self, user_id, course_key_string, language):
return


def create_export_tarball(course_module, course_key, context, status=None):
def create_export_tarball(course_block, course_key, context, status=None):
"""
Generates the export tarball, or returns None if there was an error.

Updates the context with any error information if applicable.
"""
name = course_module.url_name
name = course_block.url_name
export_file = NamedTemporaryFile(prefix=name + '.', suffix=".tar.gz") # lint-amnesty, pylint: disable=consider-using-with
root_dir = path(mkdtemp())

try:
if isinstance(course_key, LibraryLocator):
export_library_to_xml(modulestore(), contentstore(), course_key, root_dir, name)
else:
export_course_to_xml(modulestore(), contentstore(), course_module.id, root_dir, name)
export_course_to_xml(modulestore(), contentstore(), course_block.id, root_dir, name)

if status:
status.set_state('Compressing')
Expand Down
Loading