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
f87e5cef
Commit
f87e5cef
authored
Dec 13, 2012
by
chrisndodge
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1152 from MITx/feature/dhm/cms-settings
Don't save null about items to db as it chokes lms.
parents
bb3b7cb3
e2918c2d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
cms/djangoapps/contentstore/utils.py
+10
-0
cms/djangoapps/models/settings/course_details.py
+5
-4
No files found.
cms/djangoapps/contentstore/utils.py
View file @
f87e5cef
...
...
@@ -116,3 +116,12 @@ def compute_unit_state(unit):
def
get_date_display
(
date
):
return
date
.
strftime
(
"
%
d
%
B,
%
Y at
%
I:
%
M
%
p"
)
def
update_item
(
location
,
value
):
"""
If value is None, delete the db entry. Otherwise, update it using the correct modulestore.
"""
if
value
is
None
:
get_modulestore
(
location
)
.
delete_item
(
location
)
else
:
get_modulestore
(
location
)
.
update_item
(
location
,
value
)
\ No newline at end of file
cms/djangoapps/models/settings/course_details.py
View file @
f87e5cef
...
...
@@ -7,6 +7,7 @@ import time
from
contentstore.utils
import
get_modulestore
from
util.converters
import
jsdate_to_time
,
time_to_date
from
cms.djangoapps.models.settings
import
course_grading
from
cms.djangoapps.contentstore.utils
import
update_item
class
CourseDetails
:
def
__init__
(
self
,
location
):
...
...
@@ -117,16 +118,16 @@ class CourseDetails:
# NOTE: below auto writes to the db w/o verifying that any of the fields actually changed
# to make faster, could compare against db or could have client send over a list of which fields changed.
temploc
=
Location
(
course_location
)
.
_replace
(
category
=
'about'
,
name
=
'syllabus'
)
get_modulestore
(
temploc
)
.
update_item
(
temploc
,
jsondict
[
'syllabus'
])
update_item
(
temploc
,
jsondict
[
'syllabus'
])
temploc
=
temploc
.
_replace
(
name
=
'overview'
)
get_modulestore
(
temploc
)
.
update_item
(
temploc
,
jsondict
[
'overview'
])
update_item
(
temploc
,
jsondict
[
'overview'
])
temploc
=
temploc
.
_replace
(
name
=
'effort'
)
get_modulestore
(
temploc
)
.
update_item
(
temploc
,
jsondict
[
'effort'
])
update_item
(
temploc
,
jsondict
[
'effort'
])
temploc
=
temploc
.
_replace
(
name
=
'video'
)
get_modulestore
(
temploc
)
.
update_item
(
temploc
,
jsondict
[
'intro_video'
])
update_item
(
temploc
,
jsondict
[
'intro_video'
])
# Could just generate and return a course obj w/o doing any db reads, but I put the reads in as a means to confirm
...
...
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