Make updating children and data of a draft make the correct checks for whether the document is already a draft or not

This commit is contained in:
Calen Pennington
2012-10-05 11:22:31 -04:00
parent 310f26a6de
commit b079b336db

View File

@@ -112,7 +112,7 @@ class DraftModuleStore(ModuleStoreBase):
"""
draft_loc = as_draft(location)
draft_item = self.get_item(location)
if draft_item.location.revision != DRAFT:
if not draft_item.metadata['is_draft']:
self.clone_item(location, draft_loc)
return super(DraftModuleStore, self).update_item(draft_loc, data)
@@ -143,12 +143,12 @@ class DraftModuleStore(ModuleStoreBase):
draft_loc = as_draft(location)
draft_item = self.get_item(location)
if not draft_item.metadata['is_draft']:
self.clone_item(location, draft_loc)
if 'is_draft' in metadata:
del metadata['is_draft']
if draft_item.location.revision != DRAFT:
self.clone_item(location, draft_loc)
return super(DraftModuleStore, self).update_metadata(draft_loc, metadata)
def delete_item(self, location):