@@ -192,11 +192,18 @@ def get_container_from_key(container_key: LibraryContainerLocator, isDeleted=Fal
192192 raise ContentLibraryContainerNotFound
193193
194194
195- def get_container (container_key : LibraryContainerLocator , include_collections = False ) -> ContainerMetadata :
195+ def get_container (
196+ container_key : LibraryContainerLocator ,
197+ * ,
198+ include_collections = False ,
199+ container : Container | None = None ,
200+ ) -> ContainerMetadata :
196201 """
197202 Get a container (a Section, Subsection, or Unit).
198203 """
199- container = get_container_from_key (container_key )
204+ if not container :
205+ container = get_container_from_key (container_key )
206+ assert container .key == container_key .container_id
200207 if include_collections :
201208 associated_collections = authoring_api .get_entity_collections (
202209 container .publishable_entity .learning_package_id ,
@@ -372,12 +379,16 @@ def restore_container(container_key: LibraryContainerLocator) -> None:
372379
373380def get_container_children (
374381 container_key : LibraryContainerLocator ,
382+ * ,
375383 published = False ,
384+ container : Container | None = None ,
376385) -> list [LibraryXBlockMetadata | ContainerMetadata ]:
377386 """
378387 Get the entities contained in the given container (e.g. the components/xblocks in a unit)
379388 """
380- container = get_container_from_key (container_key )
389+ if not container :
390+ container = get_container_from_key (container_key )
391+ assert container .key == container_key .container_id
381392 if container_key .container_type == ContainerType .Unit .value :
382393 child_components = authoring_api .get_components_in_unit (container .unit , published = published )
383394 return [LibraryXBlockMetadata .from_component (
0 commit comments