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
2e64bc33
Commit
2e64bc33
authored
Apr 26, 2013
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make sure delete_item always uses the draft store
parent
ead18f9f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
cms/djangoapps/contentstore/views.py
+4
-2
common/lib/xmodule/xmodule/modulestore/draft.py
+7
-1
No files found.
cms/djangoapps/contentstore/views.py
View file @
2e64bc33
...
@@ -615,9 +615,11 @@ def delete_item(request):
...
@@ -615,9 +615,11 @@ def delete_item(request):
delete_children
=
request
.
POST
.
get
(
'delete_children'
,
False
)
delete_children
=
request
.
POST
.
get
(
'delete_children'
,
False
)
delete_all_versions
=
request
.
POST
.
get
(
'delete_all_versions'
,
False
)
delete_all_versions
=
request
.
POST
.
get
(
'delete_all_versions'
,
False
)
item
=
modulestore
()
.
get_item
(
item_location
)
logging
.
debug
(
'delete_all_versions = {0}'
.
format
(
delete_all_versions
)
)
store
=
get_modulestore
(
item_loc
)
store
=
modulestore
()
item
=
store
.
get_item
(
item_location
)
# @TODO: this probably leaves draft items dangling. My preferance would be for the semantic to be
# @TODO: this probably leaves draft items dangling. My preferance would be for the semantic to be
# if item.location.revision=None, then delete both draft and published version
# if item.location.revision=None, then delete both draft and published version
...
...
common/lib/xmodule/xmodule/modulestore/draft.py
View file @
2e64bc33
...
@@ -15,6 +15,12 @@ def as_draft(location):
...
@@ -15,6 +15,12 @@ def as_draft(location):
"""
"""
return
Location
(
location
)
.
_replace
(
revision
=
DRAFT
)
return
Location
(
location
)
.
_replace
(
revision
=
DRAFT
)
def
as_published
(
location
):
"""
Returns the Location that is the published version for `location`
"""
return
Location
(
location
)
.
_replace
(
revision
=
None
)
def
wrap_draft
(
item
):
def
wrap_draft
(
item
):
"""
"""
...
@@ -169,7 +175,7 @@ class DraftModuleStore(ModuleStoreBase):
...
@@ -169,7 +175,7 @@ class DraftModuleStore(ModuleStoreBase):
"""
"""
super
(
DraftModuleStore
,
self
)
.
delete_item
(
as_draft
(
location
))
super
(
DraftModuleStore
,
self
)
.
delete_item
(
as_draft
(
location
))
if
delete_all_versions
:
if
delete_all_versions
:
super
(
DraftModuleStore
,
self
)
.
delete_item
(
location
)
super
(
DraftModuleStore
,
self
)
.
delete_item
(
as_published
(
location
)
)
return
return
...
...
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