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
8827118b
Commit
8827118b
authored
May 09, 2014
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! Make course ids and usage ids opaque to LMS and Studio [partial commit]
parent
d6547988
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 @
8827118b
...
@@ -182,7 +182,7 @@ class MixedModuleStore(ModuleStoreWriteBase):
...
@@ -182,7 +182,7 @@ class MixedModuleStore(ModuleStoreWriteBase):
def
delete_course
(
self
,
course_key
,
user_id
=
None
):
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
))
assert
(
isinstance
(
course_key
,
CourseKey
))
store
=
self
.
_get_modulestore_for_courseid
(
course_key
)
store
=
self
.
_get_modulestore_for_courseid
(
course_key
)
...
...
common/lib/xmodule/xmodule/modulestore/mongo/base.py
View file @
8827118b
...
@@ -126,12 +126,16 @@ class CachingDescriptorSystem(MakoDescriptorSystem):
...
@@ -126,12 +126,16 @@ class CachingDescriptorSystem(MakoDescriptorSystem):
"""
"""
modulestore: the module store that can be used to retrieve additional modules
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
module_data: a dict mapping Location -> json that was cached from the
underlying modulestore
underlying modulestore
default_class: The default_class to use when loading an
default_class: The default_class to use when loading an
XModuleDescriptor from the module_data
XModuleDescriptor from the module_data
cached_metadata: the cache for handling inheritance computation. internal use only
resources_fs: a filesystem, as per MakoDescriptorSystem
resources_fs: a filesystem, as per MakoDescriptorSystem
error_tracker: a function that logs errors for later display to users
error_tracker: a function that logs errors for later display to users
...
...
common/lib/xmodule/xmodule/modulestore/xml_importer.py
View file @
8827118b
...
@@ -154,12 +154,12 @@ def import_from_xml(
...
@@ -154,12 +154,12 @@ def import_from_xml(
# of course modules. It will be left as a TBD to implement that
# of course modules. It will be left as a TBD to implement that
# method on XmlModuleStore.
# method on XmlModuleStore.
course_items
=
[]
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
:
if
target_course_id
is
not
None
:
dest_course_id
=
target_course_id
dest_course_id
=
target_course_id
else
:
else
:
dest_course_id
=
course_
id
dest_course_id
=
course_
key
if
create_new_course
:
if
create_new_course
:
if
store
.
has_course
(
dest_course_id
,
ignore_case
=
True
):
if
store
.
has_course
(
dest_course_id
,
ignore_case
=
True
):
...
@@ -180,17 +180,17 @@ def import_from_xml(
...
@@ -180,17 +180,17 @@ def import_from_xml(
course_data_path
=
None
course_data_path
=
None
if
verbose
:
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.
# 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
# Also we need to make sure that the course module is committed
# first into the store
# 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'
:
if
module
.
scope_ids
.
block_type
==
'course'
:
course_data_path
=
path
(
data_dir
)
/
module
.
data_dir
course_data_path
=
path
(
data_dir
)
/
module
.
data_dir
log
.
debug
(
u'======> IMPORTING course {course_
id
}'
.
format
(
log
.
debug
(
u'======> IMPORTING course {course_
key
}'
.
format
(
course_
id
=
course_id
,
course_
key
=
course_key
,
))
))
if
not
do_import_static
:
if
not
do_import_static
:
...
@@ -205,7 +205,7 @@ def import_from_xml(
...
@@ -205,7 +205,7 @@ def import_from_xml(
course
=
import_module
(
course
=
import_module
(
module
,
store
,
module
,
store
,
course_
id
,
course_
key
,
dest_course_id
,
dest_course_id
,
do_import_static
=
do_import_static
do_import_static
=
do_import_static
)
)
...
@@ -219,13 +219,13 @@ def import_from_xml(
...
@@ -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'.
# 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
# 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.
# 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
(
original_unique_wiki_slug
=
u'{0}.{1}.{2}'
.
format
(
course_
id
.
org
,
course_
key
.
org
,
course_
id
.
course
,
course_
key
.
course
,
course_
id
.
run
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
.
wiki_slug
=
u'{0}.{1}.{2}'
.
format
(
course
.
id
.
org
,
course
.
id
.
org
,
course
.
id
.
course
,
course
.
id
.
course
,
...
@@ -279,7 +279,7 @@ def import_from_xml(
...
@@ -279,7 +279,7 @@ def import_from_xml(
)
)
# finally loop through all the modules
# 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'
:
if
module
.
scope_ids
.
block_type
==
'course'
:
# we've already saved the course module up at the top
# we've already saved the course module up at the top
# of the loop so just skip over it in the inner loop
# of the loop so just skip over it in the inner loop
...
@@ -292,7 +292,7 @@ def import_from_xml(
...
@@ -292,7 +292,7 @@ def import_from_xml(
import_module
(
import_module
(
module
,
store
,
module
,
store
,
course_
id
,
course_
key
,
dest_course_id
,
dest_course_id
,
do_import_static
=
do_import_static
,
do_import_static
=
do_import_static
,
system
=
course
.
runtime
system
=
course
.
runtime
...
@@ -306,7 +306,7 @@ def import_from_xml(
...
@@ -306,7 +306,7 @@ def import_from_xml(
draft_store
,
draft_store
,
course_data_path
,
course_data_path
,
static_content_store
,
static_content_store
,
course_
id
,
course_
key
,
dest_course_id
,
dest_course_id
,
course
.
runtime
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