Skip to content

Commit c207be1

Browse files
committed
refactor: more renames and doc updates
1 parent 5ec2b33 commit c207be1

12 files changed

Lines changed: 47 additions & 48 deletions

File tree

cms/djangoapps/contentstore/views/component.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ def get_unit_tags(usage_key):
614614
Get the tags of a Unit and build a json to be read by the UI
615615
616616
Note: When migrating the `TagList` subview from `container_subview.js` to the course-authoring MFE,
617-
this function can be simplified to use the REST API of openedx-learning,
617+
this function can be simplified to use the REST API of openedx-core,
618618
which already provides this grouping + sorting logic.
619619
"""
620620
# Get content tags from content tagging API

cms/djangoapps/modulestore_migrator/api/read_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def get_migrations(
123123
is_failed: bool | None = None,
124124
) -> t.Generator[ModulestoreMigration]:
125125
"""
126-
Given some criteria, get all modulestore->LearningCore migrations.
126+
Given some criteria, get all modulestore->OexCore migrations.
127127
128128
Returns an iterable, ordered from NEWEST to OLDEST.
129129

cms/envs/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@
210210

211211
RATELIMIT_RATE = '2/m'
212212

213-
############## openedx-learning (Learning Core) config ##############
213+
############## Open edX Core (openedx-core) config ##############
214214
OPENEDX_LEARNING = {
215215
"MEDIA": {"BACKEND": "django.core.files.storage.InMemoryStorage", "OPTIONS": {"location": MEDIA_ROOT + "_private"}}
216216
}

common/templates/xblock_v2/xblock_iframe.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@
286286
// Does the XBlock HTML contain arguments to pass to the InitFunction?
287287
let data = {};
288288
[].forEach.call(element.children, (childNode) => {
289-
// The newer/pure/LearningCore runtime uses 'xblock_json_init_args'
289+
// The newer/pure/OexCore runtime uses 'xblock_json_init_args'
290290
// while the LMS runtime uses 'xblock-json-init-args'.
291291
if (
292292
childNode.matches('script.xblock_json_init_args')
@@ -405,13 +405,13 @@
405405
//
406406
// Here that is an issue because we show a confirmation modal when clicking cancel,
407407
// if the user stays to edit all TinyMCE editors are no longer there.
408-
//
408+
//
409409
// We uncouple the listener to avoid remove the TinyMCE editors
410410
const extraCancelSelector = '.cancel-button';
411411
const elements = $(extraCancelSelector).first();
412412
if (elements.length) {
413413
elements.first().unbind("click");
414-
elements.on('click', function() {
414+
elements.on('click', function() {
415415
event.preventDefault();
416416
runtime.notify('cancel', {});
417417
});
@@ -421,7 +421,7 @@
421421

422422
// Recursively initialize the JavaScript code of each XBlock:
423423
function initializeXBlockAndChildren(element, callback) {
424-
// The newer/pure/LearningCore runtime uses the 'data-usage' attribute, while the LMS uses 'data-usage-id'
424+
// The newer/pure/OexCore runtime uses the 'data-usage' attribute, while the LMS uses 'data-usage-id'
425425
const usageId = element.getAttribute('data-usage') || element.getAttribute('data-usage-id');
426426
if (usageId !== null) {
427427
element[USAGE_ID_KEY] = usageId;
@@ -461,7 +461,7 @@
461461
}
462462

463463
// Find the root XBlock node.
464-
// The newer/pure/LearningCore runtime uses '.xblock-v1' while the LMS runtime uses '.xblock'.
464+
// The newer/pure/OexCore runtime uses '.xblock-v1' while the LMS runtime uses '.xblock'.
465465
const rootNode = document.querySelector('.xblock, .xblock-v1'); // will always return the first matching element
466466
initializeXBlockAndChildren(rootNode, () => {
467467
});

openedx/core/djangoapps/content_libraries/api/blocks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,8 @@ def _import_staged_block(
474474
if source_assumes_global_assets:
475475
filename = f"static/{filename}"
476476

477-
# Now construct the Learning Core data models for it...
478-
# TODO: more of this logic should be pushed down to openedx-learning
477+
# Now construct the Core data models for it...
478+
# TODO: more of this logic should be pushed down to openedx-core
479479
media_type_str, _encoding = mimetypes.guess_type(filename)
480480
if not media_type_str:
481481
media_type_str = "application/octet-stream"

openedx/core/djangoapps/content_libraries/tests/test_containers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ def test_publish_subsection(self) -> None:
875875
)
876876

877877
# TODO -- remove this when containers publish their children:
878-
# https://github.com/openedx/openedx-learning/pull/307
878+
# https://github.com/openedx/openedx-core/pull/307
879879
# Removing the unit with components because the components (children of children) are not published.
880880
# If the unit is kept, the subsection continues to have changes even after it is published.
881881
self._remove_container_children(
@@ -951,7 +951,7 @@ def test_publish_section(self) -> None:
951951
)
952952

953953
# TODO -- remove this when containers publish their children:
954-
# https://github.com/openedx/openedx-learning/pull/307
954+
# https://github.com/openedx/openedx-core/pull/307
955955
# Removing the subsection with units because the units (children of children) are not published.
956956
# If the subsection is kept, the section continues to have changes even after it is published.
957957
self._remove_container_children(

openedx/core/djangoapps/xblock/api.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
from openedx.core.types import User as UserType
2929
from openedx.core.djangoapps.xblock.apps import get_xblock_app_config
3030
from openedx.core.djangoapps.xblock.learning_context.manager import get_learning_context_impl
31-
from openedx.core.djangoapps.xblock.runtime.learning_core_runtime import (
32-
LearningCoreFieldData,
33-
LearningCoreXBlockRuntime,
31+
from openedx.core.djangoapps.xblock.runtime.oex_core_runtime import (
32+
OexCoreFieldData,
33+
OexCoreXBlockRuntime,
3434
)
3535
from .data import CheckPerm, LatestVersion
3636
from .rest_api.url_converters import VersionConverter
@@ -40,7 +40,7 @@
4040
get_auto_latest_version,
4141
)
4242

43-
from .runtime.learning_core_runtime import LearningCoreXBlockRuntime
43+
from .runtime.oex_core_runtime import OexCoreXBlockRuntime
4444

4545
# Made available as part of this package's public API:
4646
from openedx.core.djangoapps.xblock.learning_context import LearningContext
@@ -50,7 +50,7 @@
5050
log = logging.getLogger(__name__)
5151

5252

53-
def get_runtime(user: UserType | None) -> LearningCoreXBlockRuntime:
53+
def get_runtime(user: UserType | None) -> OexCoreXBlockRuntime:
5454
"""
5555
Return a new XBlockRuntime.
5656
@@ -62,9 +62,9 @@ def get_runtime(user: UserType | None) -> LearningCoreXBlockRuntime:
6262
params = get_xblock_app_config().get_runtime_params()
6363
params.update(
6464
handler_url=get_handler_url,
65-
authored_data_store=LearningCoreFieldData(),
65+
authored_data_store=OexCoreFieldData(),
6666
)
67-
runtime = LearningCoreXBlockRuntime(user, **params)
67+
runtime = OexCoreXBlockRuntime(user, **params)
6868

6969
return runtime
7070

openedx/core/djangoapps/xblock/apps.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class XBlockAppConfig(AppConfig):
1818

1919
def get_runtime_params(self):
2020
"""
21-
Get the LearningCoreXBlockRuntime parameters appropriate for viewing and/or
21+
Get the OexCoreXBlockRuntime parameters appropriate for viewing and/or
2222
editing XBlock content.
2323
"""
2424
raise NotImplementedError
@@ -45,7 +45,7 @@ class LmsXBlockAppConfig(XBlockAppConfig):
4545

4646
def get_runtime_params(self):
4747
"""
48-
Get the LearningCoreXBlockRuntime parameters appropriate for viewing and/or
48+
Get the OexCoreXBlockRuntime parameters appropriate for viewing and/or
4949
editing XBlock content in the LMS
5050
"""
5151
return dict(
@@ -68,7 +68,7 @@ class StudioXBlockAppConfig(XBlockAppConfig):
6868

6969
def get_runtime_params(self):
7070
"""
71-
Get the LearningCoreXBlockRuntime parameters appropriate for viewing and/or
71+
Get the OexCoreXBlockRuntime parameters appropriate for viewing and/or
7272
editing XBlock content in Studio
7373
"""
7474
return dict(

openedx/core/djangoapps/xblock/runtime/learning_core_runtime.py renamed to openedx/core/djangoapps/xblock/runtime/oex_core_runtime.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,30 @@
3333
log = logging.getLogger(__name__)
3434

3535

36-
class LearningCoreFieldData(FieldData):
36+
class OexCoreFieldData(FieldData):
3737
"""
3838
FieldData for the Learning Core XBlock Runtime
3939
40-
LearningCoreFieldData only supports the ``content`` and ``settings`` scopes.
40+
OexCoreFieldData only supports the ``content`` and ``settings`` scopes.
4141
Any attempt to read or write fields with other scopes will raise a
4242
``NotImplementedError``. This class does NOT support the parent and children
4343
scopes.
4444
45-
LearningCoreFieldData should only live for the duration of one request. The
46-
interaction between LearningCoreXBlockRuntime and LearningCoreFieldData is
45+
OexCoreFieldData should only live for the duration of one request. The
46+
interaction between OexCoreXBlockRuntime and OexCoreFieldData is
4747
as follows:
4848
49-
1. LearningCoreXBlockRuntime knows how retrieve authored content data from
50-
the Learning Core APIs in openedx-learning. This content is stored as
51-
OLX, and LearningCoreXBlockRuntime won't know how to parse it into
49+
1. OexCoreXBlockRuntime knows how retrieve authored content data from
50+
the Content API in openedx-core. This content is stored as
51+
OLX, and OexCoreXBlockRuntime won't know how to parse it into
5252
fields, since serialization logic can happen in the XBlock itself.
53-
2. LearningCoreXBlockRuntime will then invoke the block to parse the OLX and
54-
then force_save its field data into LearningCoreFieldData.
53+
2. OexCoreXBlockRuntime will then invoke the block to parse the OLX and
54+
then force_save its field data into OexCoreFieldData.
5555
3. After this point, various handler and API calls might alter fields for
5656
a given block using the XBlock.
57-
4. The main thing that LearningCoreXBlockRuntime will want to know later on
57+
4. The main thing that OexCoreXBlockRuntime will want to know later on
5858
is whether it needs to write any changes when its save_block method is
59-
invoked. To support this, LearningCoreFieldData needs to track which
59+
invoked. To support this, OexCoreFieldData needs to track which
6060
blocks have changes to any of their fields. See the marked_unchanged
6161
method docstring for more details.
6262
"""
@@ -74,9 +74,9 @@ def mark_unchanged(self, block):
7474
Calling set or delete on a field always marks the block with that field
7575
as changed, by adding its usage key to self.changed. But set() is also
7676
called at the very beginning, when a block is first loaded from the
77-
database by the LearningCoreXBlockRuntime's get_block call.
77+
database by the OexCoreXBlockRuntime's get_block call.
7878
79-
This method exists so that LearningCoreXBlockRuntime can call it
79+
This method exists so that OexCoreXBlockRuntime can call it
8080
whenever it has either just done a get_block operation (because those
8181
set() calls represent the already-persisted content state), or a
8282
save_block operation (since those changes will have been persisted).
@@ -153,14 +153,14 @@ def _check_field(self, block, name):
153153
if field.scope not in (Scope.content, Scope.settings):
154154
raise NotImplementedError(
155155
f"Scope {field.scope} (field {name} of {block.scope_ids.usage_id}) "
156-
"is unsupported. LearningCoreFieldData only supports the content"
156+
"is unsupported. OexCoreFieldData only supports the content"
157157
" and settings scopes."
158158
)
159159

160160

161-
class LearningCoreXBlockRuntime(XBlockRuntime):
161+
class OexCoreXBlockRuntime(XBlockRuntime):
162162
"""
163-
XBlock runtime that uses openedx-learning apps for content storage.
163+
XBlock runtime that uses openedx-core APIs (not ModuleStore).
164164
165165
The superclass is doing all the hard stuff. This class only only has to
166166
worry about the block storage, block serialization/de-serialization, and
@@ -173,7 +173,7 @@ def get_block(self, usage_key, for_parent=None, *, version: int | LatestVersion
173173
174174
This method will find the OLX for the content in Learning Core, parse it
175175
into an XBlock (with mixins) instance, and properly initialize our
176-
internal LearningCoreFieldData instance with the field values from the
176+
internal OexCoreFieldData instance with the field values from the
177177
parsed OLX.
178178
"""
179179
# We can do this more efficiently in a single query later, but for now

openedx/core/djangoapps/xblock/runtime/runtime.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,14 @@ def applicable_aside_types(self, block: XBlock):
259259

260260
def parse_xml_file(self, fileobj):
261261
# Deny access to the inherited method
262-
raise NotImplementedError("XML Serialization is only supported with LearningCoreXBlockRuntime")
262+
raise NotImplementedError("XML Serialization is only supported with OexCoreXBlockRuntime")
263263

264264
def add_node_as_child(self, block, node):
265265
"""
266266
Called by XBlock.parse_xml to treat a child node as a child block.
267267
"""
268268
# Deny access to the inherited method
269-
raise NotImplementedError("XML Serialization is only supported with LearningCoreXBlockRuntime")
269+
raise NotImplementedError("XML Serialization is only supported with OexCoreXBlockRuntime")
270270

271271
def service(self, block: XBlock, service_name: str):
272272
"""

0 commit comments

Comments
 (0)