Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
bf414cf9
Commit
bf414cf9
authored
Apr 02, 2015
by
Jonathan Piacenti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Redid _get_library one more time, for giggles
parent
fa95d323
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
12 deletions
+4
-12
common/lib/xmodule/xmodule/library_tools.py
+4
-12
No files found.
common/lib/xmodule/xmodule/library_tools.py
View file @
bf414cf9
...
...
@@ -16,7 +16,7 @@ class LibraryToolsService(object):
def
__init__
(
self
,
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
'library' XBlock with meta-information about the library.
...
...
@@ -28,18 +28,10 @@ class LibraryToolsService(object):
if
not
isinstance
(
library_key
,
LibraryLocator
):
library_key
=
LibraryLocator
.
from_string
(
library_key
)
assert
library_key
.
version_guid
is
None
if
version
:
library_key
=
library_key
.
for_version
(
version
)
try
:
library
=
self
.
store
.
get_library
(
return
self
.
store
.
get_library
(
library_key
,
remove_version
=
False
,
remove_branch
=
False
,
head_validation
=
False
)
if
version
:
assert
library_key
.
version_guid
==
library
.
location
.
version_guid
return
library
except
ItemNotFoundError
:
return
None
...
...
@@ -133,8 +125,8 @@ class LibraryToolsService(object):
return
source_blocks
=
[]
library_key
=
dest_block
.
source_library_key
library
=
self
.
_get_library
(
library_key
,
version
=
version
)
library_key
=
dest_block
.
source_library_key
.
for_version
(
version
)
library
=
self
.
_get_library
(
library_key
)
if
library
is
None
:
raise
ValueError
(
"Requested library not found."
)
if
user_perms
and
not
user_perms
.
can_read
(
library_key
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment