From 4b0eabaacd59c3ff9d34a766970b8d141988da8e Mon Sep 17 00:00:00 2001 From: andrey-canon Date: Fri, 26 Apr 2024 16:19:44 -0500 Subject: [PATCH] fix: handle paste of library content blocks correctly (#33926) --- .../core/djangoapps/content_libraries/api.py | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/openedx/core/djangoapps/content_libraries/api.py b/openedx/core/djangoapps/content_libraries/api.py index 1b03ea5e5a0f..bbed7d123e90 100644 --- a/openedx/core/djangoapps/content_libraries/api.py +++ b/openedx/core/djangoapps/content_libraries/api.py @@ -86,7 +86,15 @@ from xblock.exceptions import XBlockNotFoundError from edx_rest_api_client.client import OAuthAPIClient from openedx.core.djangoapps.content_libraries import permissions -from openedx.core.djangoapps.content_libraries.constants import DRAFT_NAME, COMPLEX +# pylint: disable=unused-import +from openedx.core.djangoapps.content_libraries.constants import ( + ALL_RIGHTS_RESERVED, + CC_4_BY, + COMPLEX, + DRAFT_NAME, + PROBLEM, + VIDEO, +) from openedx.core.djangoapps.content_libraries.library_bundle import LibraryBundle from openedx.core.djangoapps.content_libraries.libraries_index import ContentLibraryIndexer, LibraryBlockIndexer from openedx.core.djangoapps.content_libraries.models import ( @@ -406,8 +414,15 @@ def get_library(library_key): def create_library( - collection_uuid, library_type, org, slug, title, description, allow_public_learning, allow_public_read, - library_license, + collection_uuid, + org, + slug, + title, + description="", + allow_public_learning=False, + allow_public_read=False, + library_license=ALL_RIGHTS_RESERVED, + library_type=COMPLEX, ): """ Create a new content library. @@ -424,6 +439,8 @@ def create_library( allow_public_read: Allow anyone to view blocks (including source) in Studio? + library_type: Deprecated parameter, not really used. Set to COMPLEX. + Returns a ContentLibraryMetadata instance. """ assert isinstance(collection_uuid, UUID)