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
e9db4ad1
Commit
e9db4ad1
authored
Aug 04, 2014
by
Nimisha Asthagiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LMS-11019 Add feature flag to create Split Course
parent
ec301163
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
10 deletions
+31
-10
cms/djangoapps/contentstore/views/course.py
+14
-10
cms/djangoapps/contentstore/views/item.py
+5
-0
cms/envs/common.py
+3
-0
common/lib/xmodule/xmodule/modulestore/split_mongo/caching_descriptor_system.py
+2
-0
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
+7
-0
No files found.
cms/djangoapps/contentstore/views/course.py
View file @
e9db4ad1
...
...
@@ -26,7 +26,8 @@ from xmodule.partitions.partitions import UserPartition, Group
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
,
InvalidLocationError
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.locations
import
Location
,
SlashSeparatedCourseKey
from
opaque_keys.edx.locations
import
Location
from
opaque_keys.edx.locator
import
CourseLocator
from
contentstore.course_info_model
import
get_course_updates
,
update_course_updates
,
delete_course_update
from
contentstore.utils
import
(
...
...
@@ -460,7 +461,7 @@ def _create_or_rerun_course(request):
status
=
400
)
course_key
=
SlashSeparatedCourseKey
(
org
,
number
,
run
)
course_key
=
CourseLocator
(
org
,
number
,
run
)
fields
=
{
'display_name'
:
display_name
}
if
display_name
is
not
None
else
{}
if
'source_course_key'
in
request
.
json
:
...
...
@@ -492,6 +493,7 @@ def _create_new_course(request, course_key, fields):
"""
Create a new course.
Returns the URL for the course overview page.
Raises InvalidLocationError if the course already exists
"""
# Set a unique wiki_slug for newly created courses. To maintain active wiki_slugs for
# existing xml courses this cannot be changed in CourseDescriptor.
...
...
@@ -501,14 +503,16 @@ def _create_new_course(request, course_key, fields):
definition_data
=
{
'wiki_slug'
:
wiki_slug
}
fields
.
update
(
definition_data
)
# Creating the course raises InvalidLocationError if an existing course with this org/name is found
new_course
=
modulestore
()
.
create_course
(
course_key
.
org
,
course_key
.
course
,
course_key
.
run
,
request
.
user
.
id
,
fields
=
fields
,
)
store
=
modulestore
()
with
store
.
default_store
(
settings
.
FEATURES
.
get
(
'DEFAULT_STORE_FOR_NEW_COURSE'
,
'mongo'
)):
# Creating the course raises InvalidLocationError if an existing course with this org/name is found
new_course
=
modulestore
()
.
create_course
(
course_key
.
org
,
course_key
.
course
,
course_key
.
run
,
request
.
user
.
id
,
fields
=
fields
,
)
# Make sure user has instructor and staff access to the new course
add_instructor
(
new_course
.
id
,
request
.
user
,
request
.
user
)
...
...
cms/djangoapps/contentstore/views/item.py
View file @
e9db4ad1
...
...
@@ -424,6 +424,11 @@ def _create_item(request):
if
display_name
is
not
None
:
metadata
[
'display_name'
]
=
display_name
# TODO need to fix components that are sending definition_data as strings, instead of as dicts
# For now, migrate them into dicts here.
if
isinstance
(
data
,
basestring
):
data
=
{
'data'
:
data
}
created_block
=
store
.
create_child
(
request
.
user
.
id
,
usage_key
,
...
...
cms/envs/common.py
View file @
e9db4ad1
...
...
@@ -106,6 +106,9 @@ FEATURES = {
# Toggles Group Configuration editing functionality
'ENABLE_GROUP_CONFIGURATIONS'
:
os
.
environ
.
get
(
'FEATURE_GROUP_CONFIGURATIONS'
),
# Modulestore to use for new courses
'DEFAULT_STORE_FOR_NEW_COURSE'
:
'mongo'
,
}
ENABLE_JASMINE
=
False
...
...
common/lib/xmodule/xmodule/modulestore/split_mongo/caching_descriptor_system.py
View file @
e9db4ad1
...
...
@@ -151,6 +151,8 @@ class CachingDescriptorSystem(MakoDescriptorSystem):
edit_info
=
json_data
.
get
(
'edit_info'
,
{})
module
.
edited_by
=
edit_info
.
get
(
'edited_by'
)
module
.
edited_on
=
edit_info
.
get
(
'edited_on'
)
module
.
published_by
=
None
# TODO
module
.
published_date
=
None
# TODO
module
.
previous_version
=
edit_info
.
get
(
'previous_version'
)
module
.
update_version
=
edit_info
.
get
(
'update_version'
)
module
.
source_version
=
edit_info
.
get
(
'source_version'
,
None
)
...
...
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
View file @
e9db4ad1
...
...
@@ -820,6 +820,12 @@ class SplitMongoModuleStore(ModuleStoreWriteBase):
the course id'd by version_guid but instead in one w/ a new version_guid. Ensure in this case that you get
the new version_guid from the locator in the returned object!
"""
# split handles all the fields in one dict not separated by scope
fields
=
kwargs
.
get
(
'fields'
,
{})
fields
.
update
(
kwargs
.
pop
(
'metadata'
,
{})
or
{})
fields
.
update
(
kwargs
.
pop
(
'definition_data'
,
{})
or
{})
kwargs
[
'fields'
]
=
fields
# find course_index entry if applicable and structures entry
index_entry
=
self
.
_get_index_if_valid
(
course_key
,
force
,
continue_version
)
structure
=
self
.
_lookup_course
(
course_key
)[
'structure'
]
...
...
@@ -1844,6 +1850,7 @@ class SplitMongoModuleStore(ModuleStoreWriteBase):
destination_block
[
'edit_info'
][
'previous_version'
]
=
previous_version
destination_block
[
'edit_info'
][
'update_version'
]
=
destination_version
destination_block
[
'edit_info'
][
'edited_by'
]
=
user_id
destination_block
[
'edit_info'
][
'edited_on'
]
=
datetime
.
datetime
.
now
(
UTC
)
else
:
destination_block
=
self
.
_new_block
(
user_id
,
new_block
[
'category'
],
...
...
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