Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
code.vt.edu will be down for maintenance from 0530-0630 EDT Wednesday, April 9th
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
ff525bea
Commit
ff525bea
authored
10 years ago
by
Ben McMorran
Browse files
Options
Downloads
Patches
Plain Diff
Fix field serialization
parent
bb90c307
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cms/djangoapps/contentstore/tasks.py
+11
-1
11 additions, 1 deletion
cms/djangoapps/contentstore/tasks.py
cms/djangoapps/contentstore/views/course.py
+3
-1
3 additions, 1 deletion
cms/djangoapps/contentstore/views/course.py
with
14 additions
and
2 deletions
cms/djangoapps/contentstore/tasks.py
+
11
−
1
View file @
ff525bea
...
...
@@ -4,7 +4,9 @@ This file contains celery tasks for contentstore views
from
celery.task
import
task
from
django.contrib.auth.models
import
User
import
json
from
xmodule.modulestore.django
import
modulestore
from
xmodule.course_module
import
CourseFields
from
xmodule.modulestore.exceptions
import
DuplicateCourseError
,
ItemNotFoundError
from
course_action_state.models
import
CourseRerunState
...
...
@@ -18,9 +20,10 @@ def rerun_course(source_course_key_string, destination_course_key_string, user_i
Reruns a course in a new celery task.
"""
try
:
# deserialize the
keys
# deserialize the
payload
source_course_key
=
CourseKey
.
from_string
(
source_course_key_string
)
destination_course_key
=
CourseKey
.
from_string
(
destination_course_key_string
)
fields
=
deserialize_fields
(
fields
)
# use the split modulestore as the store for the rerun course,
# as the Mongo modulestore doesn't support multiple runs of the same course.
...
...
@@ -53,3 +56,10 @@ def rerun_course(source_course_key_string, destination_course_key_string, user_i
pass
return
"
exception:
"
+
unicode
(
exc
)
def
deserialize_fields
(
json_fields
):
fields
=
json
.
loads
(
json_fields
)
for
field_name
,
value
in
fields
.
iteritems
():
fields
[
field_name
]
=
getattr
(
CourseFields
,
field_name
).
from_json
(
value
)
return
fields
This diff is collapsed.
Click to expand it.
cms/djangoapps/contentstore/views/course.py
+
3
−
1
View file @
ff525bea
...
...
@@ -23,6 +23,7 @@ from xmodule.modulestore.django import modulestore
from
xmodule.contentstore.content
import
StaticContent
from
xmodule.tabs
import
PDFTextbookTabs
from
xmodule.partitions.partitions
import
UserPartition
,
Group
from
xmodule.modulestore
import
EdxJSONEncoder
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
,
DuplicateCourseError
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.locations
import
Location
...
...
@@ -614,7 +615,8 @@ def _rerun_course(request, org, number, run, fields):
CourseRerunState
.
objects
.
initiated
(
source_course_key
,
destination_course_key
,
request
.
user
,
fields
[
'
display_name
'
])
# Rerun the course as a new celery task
rerun_course
.
delay
(
unicode
(
source_course_key
),
unicode
(
destination_course_key
),
request
.
user
.
id
,
fields
)
json_fields
=
json
.
dumps
(
fields
,
cls
=
EdxJSONEncoder
)
rerun_course
.
delay
(
unicode
(
source_course_key
),
unicode
(
destination_course_key
),
request
.
user
.
id
,
json_fields
)
# Return course listing page
return
JsonResponse
({
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment