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
4403eb72
Commit
4403eb72
authored
Feb 12, 2014
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix STUD-1311 (Don't overwrite published content w/ draft content accidentally)
parent
f7e78544
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
cms/djangoapps/contentstore/views/item.py
+3
-2
common/lib/xmodule/xmodule/modulestore/mongo/draft.py
+14
-0
No files found.
cms/djangoapps/contentstore/views/item.py
View file @
4403eb72
...
...
@@ -112,7 +112,8 @@ def xblock_handler(request, tag=None, package_id=None, branch=None, version_guid
accept_header
=
request
.
META
.
get
(
'HTTP_ACCEPT'
,
'application/json'
)
if
'application/x-fragment+json'
in
accept_header
:
component
=
modulestore
()
.
get_item
(
old_location
)
store
=
get_modulestore
(
old_location
)
component
=
store
.
get_item
(
old_location
)
# Wrap the generated fragment in the xmodule_editor div so that the javascript
# can bind to it correctly
...
...
@@ -127,7 +128,7 @@ def xblock_handler(request, tag=None, package_id=None, branch=None, version_guid
log
.
debug
(
"Unable to render studio_view for
%
r"
,
component
,
exc_info
=
True
)
editor_fragment
=
Fragment
(
render_to_string
(
'html_error.html'
,
{
'message'
:
str
(
exc
)}))
modulestore
()
.
save_xmodule
(
component
)
store
.
save_xmodule
(
component
)
preview_fragment
=
get_preview_fragment
(
request
,
component
)
...
...
common/lib/xmodule/xmodule/modulestore/mongo/draft.py
View file @
4403eb72
...
...
@@ -108,6 +108,20 @@ class DraftModuleStore(MongoModuleStore):
raise
InvalidVersionError
(
location
)
return
super
(
DraftModuleStore
,
self
)
.
create_xmodule
(
draft_loc
,
definition_data
,
metadata
,
system
)
def
save_xmodule
(
self
,
xmodule
):
"""
Save the given xmodule (will either create or update based on whether id already exists).
Pulls out the data definition v metadata v children locally but saves it all.
:param xmodule:
"""
orig_location
=
xmodule
.
location
xmodule
.
location
=
as_draft
(
orig_location
)
try
:
super
(
DraftModuleStore
,
self
)
.
save_xmodule
(
xmodule
)
finally
:
xmodule
.
location
=
orig_location
def
get_items
(
self
,
location
,
course_id
=
None
,
depth
=
0
):
"""
...
...
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