Skip to content

Commit 2b781cb

Browse files
kdmccormickclaude
andcommitted
refactor: Rename LearningPackage.key to package_ref for openedx-core 0.43.0
Updates callers of get_learning_package_by_key (renamed to get_learning_package_by_ref), create_learning_package, and update_learning_package to use the new package_ref kwarg, and switches .key attribute reads to .package_ref. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 395ec5d commit 2b781cb

6 files changed

Lines changed: 7 additions & 7 deletions

File tree

cms/djangoapps/modulestore_migrator/api/read_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def _block_migration_success(
209209
"""
210210
Build an instance of the migration success dataclass
211211
"""
212-
target_library_key = LibraryLocatorV2.from_string(target.learning_package.key)
212+
target_library_key = LibraryLocatorV2.from_string(target.learning_package.package_ref)
213213
target_key: LibraryUsageLocatorV2 | LibraryContainerLocator
214214
if hasattr(target, "component"):
215215
target_key = library_component_usage_key(target_library_key, target.component)

openedx/core/djangoapps/content/search/tests/test_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def setUp(self) -> None:
188188
tagging_api.add_tag_to_taxonomy(self.taxonomyB, "four")
189189

190190
# Create a collection:
191-
self.learning_package = content_api.get_learning_package_by_key(self.library.key)
191+
self.learning_package = content_api.get_learning_package_by_ref(str(self.library.key))
192192
with freeze_time(self.created_date):
193193
self.collection = content_api.create_collection(
194194
learning_package_id=self.learning_package.id,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,14 +461,14 @@ def create_library(
461461
# and also update its title/description in case they differ.
462462
content_api.update_learning_package(
463463
learning_package.id,
464-
key=str(ref.library_key),
464+
package_ref=str(ref.library_key),
465465
title=title,
466466
description=description,
467467
)
468468
else:
469469
# We have to generate a new LearningPackage for this library.
470470
learning_package = content_api.create_learning_package(
471-
key=str(ref.library_key),
471+
package_ref=str(ref.library_key),
472472
title=title,
473473
description=description,
474474
)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ def get_component_version_asset(request, component_version_uuid, asset_path):
379379

380380
# Permissions check...
381381
learning_package = component_version.component.learning_package
382-
library_key = LibraryLocatorV2.from_string(learning_package.key)
382+
library_key = LibraryLocatorV2.from_string(learning_package.package_ref)
383383
api.require_permission_for_library_key(
384384
library_key, request.user, permissions.CAN_VIEW_THIS_CONTENT_LIBRARY,
385385
)

openedx/core/djangoapps/xblock/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def get_component_from_usage_key(usage_key: UsageKeyV2) -> Component:
199199
This is a lower-level function that will return a Component even if there is
200200
no current draft version of that Component (because it's been soft-deleted).
201201
"""
202-
learning_package = content_api.get_learning_package_by_key(
202+
learning_package = content_api.get_learning_package_by_ref(
203203
str(usage_key.context_key)
204204
)
205205
return content_api.get_component_by_key(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ def _get_component_from_usage_key(self, usage_key):
326326
TODO: This is the third place where we're implementing this. Figure out
327327
where the definitive place should be and have everything else call that.
328328
"""
329-
learning_package = content_api.get_learning_package_by_key(str(usage_key.lib_key))
329+
learning_package = content_api.get_learning_package_by_ref(str(usage_key.lib_key))
330330
try:
331331
component = content_api.get_component_by_key(
332332
learning_package.id,

0 commit comments

Comments
 (0)