Commit 8d8fa0fa by Braden MacDonald Committed by Jonathan Piacenti

Partial fix perhaps?

parent 78163455
...@@ -4,6 +4,7 @@ XBlock runtime services for LibraryContentModule ...@@ -4,6 +4,7 @@ XBlock runtime services for LibraryContentModule
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
from opaque_keys.edx.locator import LibraryLocator from opaque_keys.edx.locator import LibraryLocator
from xmodule.library_content_module import ANY_CAPA_TYPE_VALUE from xmodule.library_content_module import ANY_CAPA_TYPE_VALUE
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.exceptions import ItemNotFoundError from xmodule.modulestore.exceptions import ItemNotFoundError
from xmodule.capa_module import CapaDescriptor from xmodule.capa_module import CapaDescriptor
...@@ -125,7 +126,9 @@ class LibraryToolsService(object): ...@@ -125,7 +126,9 @@ class LibraryToolsService(object):
return return
source_blocks = [] source_blocks = []
library_key = dest_block.source_library_key.for_version(version) library_key = dest_block.source_library_key
if version:
library_key = library_key.replace(branch=ModuleStoreEnum.BranchName.library, version_guid=version)
library = self._get_library(library_key) library = self._get_library(library_key)
if library is None: if library is None:
raise ValueError("Requested library not found.") raise ValueError("Requested library not found.")
......
...@@ -2205,7 +2205,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase): ...@@ -2205,7 +2205,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
# so that we can access descendant information quickly # so that we can access descendant information quickly
source_structures = {} source_structures = {}
for key in source_keys: for key in source_keys:
course_key = key.course_key.for_version(None) course_key = key.course_key
if course_key.branch is None: if course_key.branch is None:
raise ItemNotFoundError("branch is required for all source keys when using copy_from_template") raise ItemNotFoundError("branch is required for all source keys when using copy_from_template")
if course_key not in source_structures: if course_key not in source_structures:
...@@ -2264,9 +2264,9 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase): ...@@ -2264,9 +2264,9 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
new_children = list() # ordered list of the new children of new_parent_block_key new_children = list() # ordered list of the new children of new_parent_block_key
for usage_key in source_keys: for usage_key in source_keys:
src_course_key = usage_key.course_key.for_version(None) src_course_key = usage_key.course_key
block_key = BlockKey(usage_key.block_type, usage_key.block_id) block_key = BlockKey(usage_key.block_type, usage_key.block_id)
source_structure = source_structures.get(src_course_key, []) source_structure = source_structures[src_course_key]
if block_key not in source_structure['blocks']: if block_key not in source_structure['blocks']:
raise ItemNotFoundError(usage_key) raise ItemNotFoundError(usage_key)
source_block_info = source_structure['blocks'][block_key] source_block_info = source_structure['blocks'][block_key]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment