From 3e889a92be834d5b8924d6f9cae697ac1b36ccbf Mon Sep 17 00:00:00 2001 From: Navin Karkera Date: Wed, 9 Oct 2024 16:29:29 +0530 Subject: [PATCH] fix: lint issues --- openedx/core/djangoapps/content_libraries/api.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/openedx/core/djangoapps/content_libraries/api.py b/openedx/core/djangoapps/content_libraries/api.py index e5f43375866e..07d07222234f 100644 --- a/openedx/core/djangoapps/content_libraries/api.py +++ b/openedx/core/djangoapps/content_libraries/api.py @@ -231,7 +231,7 @@ class LibraryXBlockMetadata: collections = attr.ib(type=list[CollectionMetadata], factory=list) @classmethod - def from_component(cls, library_key, component, collections=None): + def from_component(cls, library_key, component, associated_collections=None): """ Construct a LibraryXBlockMetadata from a Component object. """ @@ -258,7 +258,7 @@ def from_component(cls, library_key, component, collections=None): last_draft_created=last_draft_created, last_draft_created_by=last_draft_created_by, has_unpublished_changes=component.versioning.has_unpublished_changes, - collections=collections or [], + collections=associated_collections or [], ) @@ -724,16 +724,17 @@ def get_library_block(usage_key, include_collections=False) -> LibraryXBlockMeta if not draft_version: raise ContentLibraryBlockNotFound(usage_key) - collections = [] if include_collections: - collections = authoring_api.get_entity_collections( + associated_collections = authoring_api.get_entity_collections( component.learning_package_id, component.key, ).values('key', 'title') + else: + associated_collections = None xblock_metadata = LibraryXBlockMetadata.from_component( library_key=usage_key.context_key, component=component, - collections=collections, + associated_collections=associated_collections, ) return xblock_metadata