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
b3b118ee
Commit
b3b118ee
authored
May 09, 2014
by
Don Mitchell
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3655 from edx/opaque-keys-common-lib-xmodule
Opaque keys common lib xmodule
parents
d5468fff
8827118b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
16 deletions
+20
-16
common/lib/xmodule/xmodule/modulestore/mixed.py
+1
-1
common/lib/xmodule/xmodule/modulestore/mongo/base.py
+4
-0
common/lib/xmodule/xmodule/modulestore/xml_importer.py
+15
-15
No files found.
common/lib/xmodule/xmodule/modulestore/mixed.py
View file @
b3b118ee
...
...
@@ -182,7 +182,7 @@ class MixedModuleStore(ModuleStoreWriteBase):
def
delete_course
(
self
,
course_key
,
user_id
=
None
):
"""
Remove the given course from its modulestore.
See xmodule.modulestore.__init__.ModuleStoreWrite.delete_course
"""
assert
(
isinstance
(
course_key
,
CourseKey
))
store
=
self
.
_get_modulestore_for_courseid
(
course_key
)
...
...
common/lib/xmodule/xmodule/modulestore/mongo/base.py
View file @
b3b118ee
...
...
@@ -126,12 +126,16 @@ class CachingDescriptorSystem(MakoDescriptorSystem):
"""
modulestore: the module store that can be used to retrieve additional modules
course_key: the course for which everything in this runtime will be relative
module_data: a dict mapping Location -> json that was cached from the
underlying modulestore
default_class: The default_class to use when loading an
XModuleDescriptor from the module_data
cached_metadata: the cache for handling inheritance computation. internal use only
resources_fs: a filesystem, as per MakoDescriptorSystem
error_tracker: a function that logs errors for later display to users
...
...
common/lib/xmodule/xmodule/modulestore/xml_importer.py
View file @
b3b118ee
...
...
@@ -154,12 +154,12 @@ def import_from_xml(
# of course modules. It will be left as a TBD to implement that
# method on XmlModuleStore.
course_items
=
[]
for
course_
id
in
xml_module_store
.
modules
.
keys
():
for
course_
key
in
xml_module_store
.
modules
.
keys
():
if
target_course_id
is
not
None
:
dest_course_id
=
target_course_id
else
:
dest_course_id
=
course_
id
dest_course_id
=
course_
key
if
create_new_course
:
if
store
.
has_course
(
dest_course_id
,
ignore_case
=
True
):
...
...
@@ -180,17 +180,17 @@ def import_from_xml(
course_data_path
=
None
if
verbose
:
log
.
debug
(
"Scanning {0} for course module..."
.
format
(
course_
id
))
log
.
debug
(
"Scanning {0} for course module..."
.
format
(
course_
key
))
# Quick scan to get course module as we need some info from there.
# Also we need to make sure that the course module is committed
# first into the store
for
module
in
xml_module_store
.
modules
[
course_
id
]
.
itervalues
():
for
module
in
xml_module_store
.
modules
[
course_
key
]
.
itervalues
():
if
module
.
scope_ids
.
block_type
==
'course'
:
course_data_path
=
path
(
data_dir
)
/
module
.
data_dir
log
.
debug
(
u'======> IMPORTING course {course_
id
}'
.
format
(
course_
id
=
course_id
,
log
.
debug
(
u'======> IMPORTING course {course_
key
}'
.
format
(
course_
key
=
course_key
,
))
if
not
do_import_static
:
...
...
@@ -205,7 +205,7 @@ def import_from_xml(
course
=
import_module
(
module
,
store
,
course_
id
,
course_
key
,
dest_course_id
,
do_import_static
=
do_import_static
)
...
...
@@ -219,13 +219,13 @@ def import_from_xml(
# Original wiki_slugs had value location.course. To make them unique this was changed to 'org.course.name'.
# If we are importing into a course with a different course_id and wiki_slug is equal to either of these default
# values then remap it so that the wiki does not point to the old wiki.
if
course_
id
!=
course
.
id
:
if
course_
key
!=
course
.
id
:
original_unique_wiki_slug
=
u'{0}.{1}.{2}'
.
format
(
course_
id
.
org
,
course_
id
.
course
,
course_
id
.
run
course_
key
.
org
,
course_
key
.
course
,
course_
key
.
run
)
if
course
.
wiki_slug
==
original_unique_wiki_slug
or
course
.
wiki_slug
==
course_
id
.
course
:
if
course
.
wiki_slug
==
original_unique_wiki_slug
or
course
.
wiki_slug
==
course_
key
.
course
:
course
.
wiki_slug
=
u'{0}.{1}.{2}'
.
format
(
course
.
id
.
org
,
course
.
id
.
course
,
...
...
@@ -279,7 +279,7 @@ def import_from_xml(
)
# finally loop through all the modules
for
module
in
xml_module_store
.
modules
[
course_
id
]
.
itervalues
():
for
module
in
xml_module_store
.
modules
[
course_
key
]
.
itervalues
():
if
module
.
scope_ids
.
block_type
==
'course'
:
# we've already saved the course module up at the top
# of the loop so just skip over it in the inner loop
...
...
@@ -292,7 +292,7 @@ def import_from_xml(
import_module
(
module
,
store
,
course_
id
,
course_
key
,
dest_course_id
,
do_import_static
=
do_import_static
,
system
=
course
.
runtime
...
...
@@ -306,7 +306,7 @@ def import_from_xml(
draft_store
,
course_data_path
,
static_content_store
,
course_
id
,
course_
key
,
dest_course_id
,
course
.
runtime
)
...
...
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