per feedback, change back 'draft-aware' modulestore to not delete the published copy. In delete_item in views.py do the logic to determine whether we should be using a 'draft-aware' modulestore or not, based on the category type

This commit is contained in:
Chris Dodge
2012-10-12 09:25:13 -04:00
committed by Calen Pennington
parent 1015b3a974
commit 281f194b2a
2 changed files with 9 additions and 6 deletions

View File

@@ -470,10 +470,16 @@ def delete_item(request):
item = modulestore().get_item(item_location)
_direct_delete_categories = ['course', 'chapter', 'sequential']
# @TODO: this probably leaves draft items dangling.
if delete_children:
_xmodule_recurse(item, lambda i: modulestore().delete_item(i.location))
_xmodule_recurse(item, lambda i: modulestore('direct' if
i.location.category in _direct_delete_categories else 'direct').delete_item(i.location))
else:
modulestore().delete_item(item.location)
modulestore('direct' if
item.location.category in _direct_delete_categories else 'direct').delete_item(item.location)
return HttpResponse()

View File

@@ -157,11 +157,8 @@ class DraftModuleStore(ModuleStoreBase):
location: Something that can be passed to Location
"""
return super(DraftModuleStore, self).delete_item(as_draft(location))
# cdodge: we should always delete both the draft and the original
super(DraftModuleStore, self).delete_item(as_draft(location))
if (location.revision == None): # did caller request to delete the non-draft, if so be sure to do that
super(DraftModuleStore, self).delete_item(location)
def get_parent_locations(self, location):
'''Find all locations that are the parents of this location. Needed