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
39e26404
Commit
39e26404
authored
May 21, 2014
by
Calen Pennington
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3778 from cpennington/mixed-modulestore-bad-keys
Handle malformed keys in MixedModuleStore configuration
parents
50d66be2
ef108333
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
common/lib/xmodule/xmodule/modulestore/mixed.py
+6
-2
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
+3
-1
No files found.
common/lib/xmodule/xmodule/modulestore/mixed.py
View file @
39e26404
...
...
@@ -40,7 +40,11 @@ class MixedModuleStore(ModuleStoreWriteBase):
try
:
self
.
mappings
[
CourseKey
.
from_string
(
course_id
)]
=
store_name
except
InvalidKeyError
:
try
:
self
.
mappings
[
SlashSeparatedCourseKey
.
from_deprecated_string
(
course_id
)]
=
store_name
except
InvalidKeyError
:
log
.
exception
(
"Invalid MixedModuleStore configuration. Unable to parse course_id
%
r"
,
course_id
)
continue
if
'default'
not
in
stores
:
raise
Exception
(
'Missing a default modulestore in the MixedModuleStore __init__ method.'
)
...
...
@@ -50,8 +54,8 @@ class MixedModuleStore(ModuleStoreWriteBase):
if
is_xml
:
# restrict xml to only load courses in mapping
store
[
'OPTIONS'
][
'course_ids'
]
=
[
course_
id
for
course_
id
,
store_key
in
mappings
.
iteritems
()
course_
key
.
to_deprecated_string
()
for
course_
key
,
store_key
in
self
.
mappings
.
iteritems
()
if
store_key
==
key
]
self
.
modulestores
[
key
]
=
create_modulestore_instance
(
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
View file @
39e26404
...
...
@@ -38,6 +38,7 @@ class TestMixedModuleStore(LocMapperSetupSansDjango):
MONGO_COURSEID
=
'MITx/999/2013_Spring'
XML_COURSEID1
=
'edX/toy/2012_Fall'
XML_COURSEID2
=
'edX/simple/2012_Fall'
BAD_COURSE_ID
=
'edX/simple'
modulestore_options
=
{
'default_class'
:
DEFAULT_CLASS
,
...
...
@@ -53,7 +54,8 @@ class TestMixedModuleStore(LocMapperSetupSansDjango):
'mappings'
:
{
XML_COURSEID1
:
'xml'
,
XML_COURSEID2
:
'xml'
,
MONGO_COURSEID
:
'default'
BAD_COURSE_ID
:
'xml'
,
MONGO_COURSEID
:
'default'
,
},
'stores'
:
{
'xml'
:
{
...
...
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