Commit ce19c769 by Jonathan Piacenti

Fix handling of library versions in the library tools.

parent 51905f0c
...@@ -16,7 +16,7 @@ class LibraryToolsService(object): ...@@ -16,7 +16,7 @@ class LibraryToolsService(object):
def __init__(self, modulestore): def __init__(self, modulestore):
self.store = modulestore self.store = modulestore
def _get_library(self, library_key, version=None): def _get_library(self, library_key):
""" """
Given a library key like "library-v1:ProblemX+PR0B", return the Given a library key like "library-v1:ProblemX+PR0B", return the
'library' XBlock with meta-information about the library. 'library' XBlock with meta-information about the library.
...@@ -28,9 +28,6 @@ class LibraryToolsService(object): ...@@ -28,9 +28,6 @@ class LibraryToolsService(object):
if not isinstance(library_key, LibraryLocator): if not isinstance(library_key, LibraryLocator):
library_key = LibraryLocator.from_string(library_key) library_key = LibraryLocator.from_string(library_key)
if version:
library_key.for_version(version)
try: try:
return self.store.get_library(library_key, remove_version=False, remove_branch=False) return self.store.get_library(library_key, remove_version=False, remove_branch=False)
except ItemNotFoundError: except ItemNotFoundError:
...@@ -126,8 +123,8 @@ class LibraryToolsService(object): ...@@ -126,8 +123,8 @@ class LibraryToolsService(object):
return return
source_blocks = [] source_blocks = []
library_key = dest_block.source_library_key library_key = dest_block.source_library_key.for_version(version)
library = self._get_library(library_key, version=version) 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.")
if user_perms and not user_perms.can_read(library_key): if user_perms and not user_perms.can_read(library_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