Skip to content

[BD-13][BB-6735] refactor: Unify XBlock naming - #31113

Merged
Agrendalath merged 25 commits into
openedx:masterfrom
open-craft:0x29a/bb6735/unify_xblock_naming
Dec 19, 2022
Merged

[BD-13][BB-6735] refactor: Unify XBlock naming#31113
Agrendalath merged 25 commits into
openedx:masterfrom
open-craft:0x29a/bb6735/unify_xblock_naming

Conversation

@0x29a

@0x29a 0x29a commented Oct 5, 2022

Copy link
Copy Markdown
Contributor

Description

Since the XModules framework legacy code is being removed, it's time to unify the terms used to refer to XBlocks.

As there are tens of thousands occurrences of module, descriptor and item across the platform code, this PR covers getting rid of the module term in the context of renaming XBlocks files in the xmodule/ directory.

Specifically, this PR:

  • Renames the following files / directories and updates corresponding imports:
    • xmodule/annotatable_module.py -> xmodule/annotatable_block.py
    • xmodule/capa_module.py -> xmodule/capa_block.py
    • xmodule/conditional_module.py -> xmodule/conditional_block.py
    • xmodule/course_module.py -> xmodule/course_block.py
    • xmodule/editing_module.py -> xmodule/editing_block.py
    • xmodule/error_module.py -> xmodule/error_block.py
    • xmodule/hidden_module.py -> xmodule/hidden_block.py
    • xmodule/html_module.py -> xmodule/html_block.py
    • xmodule/library_content_module.py -> xmodule/library_content_block.py
    • xmodule/lti_module.py -> xmodule/lti_block.py
    • xmodule/mako_module.py -> xmodule/mako_block.py
    • xmodule/poll_module.py -> xmodule/poll_block.py
    • xmodule/randomize_module.py -> xmodule/randomize_block.py
    • xmodule/raw_module.py -> xmodule/raw_block.py
    • xmodule/seq_module.py -> xmodule/seq_block.py
    • xmodule/template_module.py -> xmodule/template_block.py
    • xmodule/word_cloud_module.py -> xmodule/word_cloud_block.py
    • xmodule/wrapper_module.py -> xmodule/wrapper_block.py
    • xmodule/xml_module.py -> xmodule/xml_block.py
    • xmodule/video_module -> xmodule/video_block and xmodule/video_module/video_module.py -> xmodule/video_block/video_block.py
    • xmodule/split_test_module.py -> xmodule/split_test_block.py
  • For each file, it also renames strings like course module / course_module / coursemodule in comments, string constants and function names (where it's safe).
  • Updates path to these files in *.po files.

Supporting information

Testing instructions

Use https://extpr31113.sandbox.opencraft.hosting (email: staff@example.com, password: edx) to perform general testing.

@openedx-webhooks

openedx-webhooks commented Oct 5, 2022

Copy link
Copy Markdown

Thanks for the pull request, @0x29a!

When this pull request is ready, tag your edX technical lead.

@openedx-webhooks openedx-webhooks added the blended PR is managed through 2U's blended developmnt program label Oct 5, 2022
@0x29a
0x29a force-pushed the 0x29a/bb6735/unify_xblock_naming branch 11 times, most recently from 7319287 to d8af31b Compare October 27, 2022 02:22
@0x29a
0x29a force-pushed the 0x29a/bb6735/unify_xblock_naming branch 8 times, most recently from 36d9603 to 993bd0a Compare November 11, 2022 13:24
@0x29a 0x29a changed the title [WIP][BD-13][BB-6735] refactor: Unify XBlock naming [BD-13][BB-6735] refactor: Unify XBlock naming Nov 14, 2022

@Agrendalath Agrendalath left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0x29a, the code looks good to me, but how can I test it locally? I followed the steps defined here, purged all caches, and recreated my devstack, but I keep getting the following exception:

Traceback (most recent call last):
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/edx/app/edxapp/edx-platform/openedx/core/djangoapps/util/maintenance_banner.py", line 42, in _decorated
    return func(request, *args, **kwargs)
  File "/edx/app/edxapp/edx-platform/common/djangoapps/student/views/dashboard.py", line 652, in student_dashboard
    errored_courses = modulestore().get_errored_courses()
  File "/edx/app/edxapp/edx-platform/xmodule/modulestore/django.py", line 330, in modulestore
    _MIXED_MODULESTORE = create_modulestore_instance(
  File "/edx/app/edxapp/edx-platform/xmodule/modulestore/django.py", line 303, in create_modulestore_instance
    return class_(
  File "/edx/app/edxapp/edx-platform/xmodule/modulestore/mixed.py", line 160, in __init__
    store = create_modulestore_instance(
  File "/edx/app/edxapp/edx-platform/xmodule/modulestore/django.py", line 303, in create_modulestore_instance
    return class_(
  File "/edx/app/edxapp/edx-platform/xmodule/modulestore/split_mongo/split.py", line 659, in __init__
    class_ = getattr(import_module(module_path), class_name)
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'xmodule.hidden_module'

Comment thread common/djangoapps/static_replace/__init__.py Outdated
Comment thread lms/djangoapps/courseware/tests/test_word_cloud.py Outdated
Comment thread xmodule/tests/test_word_cloud.py Outdated
@0x29a

0x29a commented Nov 14, 2022

Copy link
Copy Markdown
Contributor Author

@Agrendalath, ah, I forgot to mention this in the PR description. You have to run pip install -e . in the root of your container, so the openedx package is reinstalled. If that's not the case, please consider the related configuration PR. You might need to update MODULESTORE value in the lms.yml and studio.yml.

@Agrendalath

Copy link
Copy Markdown
Member

You might need to update MODULESTORE value in the lms.yml and studio.yml.

@0x29a, this one did the trick. Thanks!

@Agrendalath

Copy link
Copy Markdown
Member

@0x29a, could you please rebase the PR?

@0x29a
0x29a force-pushed the 0x29a/bb6735/unify_xblock_naming branch 2 times, most recently from 9ba4cba to a3b48cf Compare November 17, 2022 10:32
@Agrendalath
Agrendalath force-pushed the 0x29a/bb6735/unify_xblock_naming branch from a3b48cf to 3252e1c Compare November 22, 2022 09:14
@Agrendalath
Agrendalath force-pushed the 0x29a/bb6735/unify_xblock_naming branch from 1375842 to ae1dcbe Compare December 19, 2022 16:48
@Agrendalath
Agrendalath merged commit 9171914 into openedx:master Dec 19, 2022
@Agrendalath
Agrendalath deleted the 0x29a/bb6735/unify_xblock_naming branch December 19, 2022 17:09
@openedx-webhooks

Copy link
Copy Markdown

@0x29a 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production.

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

@kdmccormick

Copy link
Copy Markdown
Member

This is awesome. Great work to everyone involved in getting this point 🎸⚡

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blended PR is managed through 2U's blended developmnt program

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants