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
97331d4c
Commit
97331d4c
authored
Jul 10, 2014
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix merge conflict
parent
cfb7f99c
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
22 deletions
+14
-22
cms/djangoapps/contentstore/utils.py
+0
-1
cms/djangoapps/contentstore/views/transcripts_ajax.py
+2
-5
common/lib/xmodule/xmodule/modulestore/mongo/base.py
+1
-5
common/lib/xmodule/xmodule/modulestore/tests/test_publish.py
+5
-5
common/lib/xmodule/xmodule/modulestore/tests/test_split_w_old_mongo.py
+6
-6
No files found.
cms/djangoapps/contentstore/utils.py
View file @
97331d4c
...
...
@@ -15,7 +15,6 @@ from xmodule.modulestore import ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
from
opaque_keys.edx.keys
import
UsageKey
,
CourseKey
from
xmodule.modulestore.store_utilities
import
delete_course
from
student.roles
import
CourseInstructorRole
,
CourseStaffRole
...
...
cms/djangoapps/contentstore/views/transcripts_ajax.py
View file @
97331d4c
...
...
@@ -532,15 +532,12 @@ def _get_item(request, data):
Returns the item.
"""
usage_key
=
UsageKey
.
from_string
(
data
.
get
(
'locator'
))
# usage_key's course_key may have an empty run property
usage_key
=
usage_key
.
replace
(
course_key
=
modulestore
()
.
fill_in_run
(
usage_key
.
course_key
))
# This is placed before has_course_access() to validate the location,
# because has_course_access() raises r if location is invalid.
item
=
modulestore
()
.
get_item
(
usage_key
)
if
not
has_course_access
(
request
.
user
,
usage_key
.
course_key
):
# use the item's course_key, because the usage_key might not have the run
if
not
has_course_access
(
request
.
user
,
item
.
location
.
course_key
):
raise
PermissionDenied
()
return
item
common/lib/xmodule/xmodule/modulestore/mongo/base.py
View file @
97331d4c
...
...
@@ -849,11 +849,7 @@ class MongoModuleStore(ModuleStoreWriteBase):
modules
=
self
.
_load_items
(
course_id
,
list
(
items
))
return
modules
<<<<<<<
HEAD
def
create_course
(
self
,
org
,
offering
,
user_id
,
fields
=
None
,
**
kwargs
):
=======
def
create_course
(
self
,
org
,
course
,
run
,
user_id
=
None
,
fields
=
None
,
**
kwargs
):
>>>>>>>
Fix
up
the
signature
to
use
course
and
run
instead
of
just
offering
def
create_course
(
self
,
org
,
course
,
run
,
user_id
,
fields
=
None
,
**
kwargs
):
"""
Creates and returns the course.
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_publish.py
View file @
97331d4c
...
...
@@ -70,7 +70,7 @@ class TestPublish(SplitWMongoCourseBoostrapper):
# 02-July-2014 send calls are 7. 5 from above, plus 2 for updating subtree edit info for Chapter1 and course
# find calls are 22. 19 from above, plus 3 for finding the parent of Vert1, Chapter1, and course
with
check_mongo_calls
(
self
.
draft_mongo
,
22
,
7
):
self
.
draft_mongo
.
publish
(
item
.
location
,
self
.
userid
)
self
.
draft_mongo
.
publish
(
item
.
location
,
self
.
user
_
id
)
# verify status
item
=
self
.
draft_mongo
.
get_item
(
vert_location
,
0
)
...
...
@@ -79,7 +79,7 @@ class TestPublish(SplitWMongoCourseBoostrapper):
# delete the draft version of the discussion
location
=
self
.
old_course_key
.
make_usage_key
(
'discussion'
,
block_id
=
'Discussion1'
)
self
.
draft_mongo
.
delete_item
(
location
,
self
.
userid
)
self
.
draft_mongo
.
delete_item
(
location
,
self
.
user
_
id
)
draft_vert
=
self
.
draft_mongo
.
get_item
(
vert_location
,
0
)
self
.
assertTrue
(
getattr
(
draft_vert
,
'is_draft'
,
False
),
"Deletion didn't convert parent to draft"
)
...
...
@@ -89,10 +89,10 @@ class TestPublish(SplitWMongoCourseBoostrapper):
draft_vert
.
children
.
remove
(
other_child_loc
)
other_vert
=
self
.
draft_mongo
.
get_item
(
self
.
old_course_key
.
make_usage_key
(
'vertical'
,
block_id
=
'Vert2'
),
0
)
other_vert
.
children
.
append
(
other_child_loc
)
self
.
draft_mongo
.
update_item
(
draft_vert
,
self
.
userid
)
self
.
draft_mongo
.
update_item
(
other_vert
,
self
.
userid
)
self
.
draft_mongo
.
update_item
(
draft_vert
,
self
.
user
_
id
)
self
.
draft_mongo
.
update_item
(
other_vert
,
self
.
user
_
id
)
# publish
self
.
draft_mongo
.
publish
(
vert_location
,
self
.
userid
)
self
.
draft_mongo
.
publish
(
vert_location
,
self
.
user
_
id
)
item
=
self
.
old_mongo
.
get_item
(
vert_location
,
0
)
self
.
assertNotIn
(
location
,
item
.
children
)
self
.
assertIsNone
(
self
.
draft_mongo
.
get_parent_location
(
location
))
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_split_w_old_mongo.py
View file @
97331d4c
...
...
@@ -20,7 +20,7 @@ class SplitWMongoCourseBoostrapper(unittest.TestCase):
This class ensures the db gets created, opened, and cleaned up in addition to creating the course
Defines the following attrs on self:
* userid: a random non-registered mock user id
* user
_
id: a random non-registered mock user id
* split_mongo: a pointer to the split mongo instance
* old_mongo: a pointer to the old_mongo instance
* draft_mongo: a pointer to the old draft instance
...
...
@@ -45,7 +45,7 @@ class SplitWMongoCourseBoostrapper(unittest.TestCase):
def
setUp
(
self
):
self
.
db_config
[
'collection'
]
=
'modulestore{0}'
.
format
(
uuid
.
uuid4
()
.
hex
[:
5
])
self
.
userid
=
random
.
getrandbits
(
32
)
self
.
user
_
id
=
random
.
getrandbits
(
32
)
super
(
SplitWMongoCourseBoostrapper
,
self
)
.
setUp
()
self
.
split_mongo
=
SplitMongoModuleStore
(
None
,
...
...
@@ -90,7 +90,7 @@ class SplitWMongoCourseBoostrapper(unittest.TestCase):
mongo
=
self
.
old_mongo
else
:
mongo
=
self
.
draft_mongo
mongo
.
create_and_save_xmodule
(
location
,
self
.
userid
,
definition_data
=
data
,
metadata
=
metadata
,
runtime
=
self
.
runtime
)
mongo
.
create_and_save_xmodule
(
location
,
self
.
user
_
id
,
definition_data
=
data
,
metadata
=
metadata
,
runtime
=
self
.
runtime
)
if
isinstance
(
data
,
basestring
):
fields
=
{
'data'
:
data
}
else
:
...
...
@@ -105,7 +105,7 @@ class SplitWMongoCourseBoostrapper(unittest.TestCase):
mongo
=
self
.
draft_mongo
parent
=
mongo
.
get_item
(
parent_location
)
parent
.
children
.
append
(
location
)
mongo
.
update_item
(
parent
,
self
.
userid
)
mongo
.
update_item
(
parent
,
self
.
user
_
id
)
# create pointer for split
course_or_parent_locator
=
BlockUsageLocator
(
course_key
=
self
.
split_course_key
,
...
...
@@ -115,7 +115,7 @@ class SplitWMongoCourseBoostrapper(unittest.TestCase):
else
:
course_or_parent_locator
=
self
.
split_course_key
if
split
:
self
.
split_mongo
.
create_item
(
course_or_parent_locator
,
category
,
self
.
userid
,
block_id
=
name
,
fields
=
fields
)
self
.
split_mongo
.
create_item
(
course_or_parent_locator
,
category
,
self
.
user
_
id
,
block_id
=
name
,
fields
=
fields
)
def
_create_course
(
self
,
split
=
True
):
"""
...
...
@@ -135,7 +135,7 @@ class SplitWMongoCourseBoostrapper(unittest.TestCase):
if
split
:
# split requires the course to be created separately from creating items
self
.
split_mongo
.
create_course
(
self
.
split_course_key
.
org
,
self
.
split_course_key
.
course
,
self
.
split_course_key
.
run
,
self
.
userid
,
fields
=
fields
,
root_block_id
=
'runid'
self
.
split_course_key
.
org
,
self
.
split_course_key
.
course
,
self
.
split_course_key
.
run
,
self
.
user
_
id
,
fields
=
fields
,
root_block_id
=
'runid'
)
old_course
=
self
.
old_mongo
.
create_course
(
self
.
split_course_key
.
org
,
'test_course'
,
'runid'
,
self
.
user_id
,
fields
=
fields
)
self
.
old_course_key
=
old_course
.
id
...
...
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