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
1223c8a0
Commit
1223c8a0
authored
May 22, 2014
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
has_course was incorrect, fixed
parent
47234673
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
common/lib/xmodule/xmodule/modulestore/mongo/base.py
+6
-2
common/lib/xmodule/xmodule/modulestore/xml_importer.py
+11
-1
No files found.
common/lib/xmodule/xmodule/modulestore/mongo/base.py
View file @
1223c8a0
...
...
@@ -615,10 +615,14 @@ class MongoModuleStore(ModuleStoreWriteBase):
otherwise, do a case sensitive search
"""
assert
(
isinstance
(
course_key
,
SlashSeparatedCourseKey
))
course_query
=
self
.
_course_key_to_son
(
course_key
)
location
=
course_key
.
make_usage_key
(
'course'
,
course_key
.
run
)
if
ignore_case
:
course_query
=
location
.
to_deprecated_son
(
'_id.'
)
for
key
in
course_query
.
iterkeys
():
course_query
[
key
]
=
re
.
compile
(
r"(?i)^{}$"
.
format
(
course_query
[
key
]))
if
isinstance
(
course_query
[
key
],
basestring
):
course_query
[
key
]
=
re
.
compile
(
r"(?i)^{}$"
.
format
(
course_query
[
key
]))
else
:
course_query
=
{
'_id'
:
location
.
to_deprecated_son
()}
return
self
.
collection
.
find_one
(
course_query
,
fields
=
{
'_id'
:
True
})
is
not
None
def
has_item
(
self
,
usage_key
):
...
...
common/lib/xmodule/xmodule/modulestore/xml_importer.py
View file @
1223c8a0
...
...
@@ -15,6 +15,7 @@ from xmodule.errortracker import make_error_tracker
from
.store_utilities
import
rewrite_nonportable_content_links
import
xblock
from
xmodule.tabs
import
CourseTabList
from
xmodule.modulestore.exceptions
import
InvalidLocationError
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -165,6 +166,7 @@ def import_from_xml(
dest_course_id
=
course_key
if
create_new_course
:
# this tests if exactly this course (ignoring case) exists; so, it checks the run
if
store
.
has_course
(
dest_course_id
,
ignore_case
=
True
):
log
.
debug
(
"Skipping import of course with id, {0},"
...
...
@@ -172,7 +174,15 @@ def import_from_xml(
)
continue
else
:
store
.
create_course
(
dest_course_id
.
org
,
dest_course_id
.
offering
)
try
:
store
.
create_course
(
dest_course_id
.
org
,
dest_course_id
.
offering
)
except
InvalidLocationError
:
# course w/ same org and course exists and store is old mongo
log
.
debug
(
"Skipping import of course with id, {0},"
"since it collides with an existing one"
.
format
(
dest_course_id
)
)
continue
try
:
# turn off all write signalling while importing as this
...
...
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