Delete items by their asset_key instead of _id.
The _id comes back as a dict and it's in the wrong order compared to the dict stored in mongo. This results in lookups for deletion failing when we use the '_id' as the lookup key. Luckily the delete function also takes the asset_key as a valid key to delete by so we just use that instead.
This commit is contained in:
@@ -335,7 +335,8 @@ class AuthTestCase(ContentStoreTestCase):
|
|||||||
is turned off
|
is turned off
|
||||||
"""
|
"""
|
||||||
response = self.client.get(reverse('login'))
|
response = self.client.get(reverse('login'))
|
||||||
self.assertNotContains(response,
|
self.assertNotContains(
|
||||||
|
response,
|
||||||
'<a href="/signup" class="action action-signin">Don't have a Studio Account? Sign up!</a>'
|
'<a href="/signup" class="action action-signin">Don't have a Studio Account? Sign up!</a>'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -16,13 +16,13 @@ def empty_asset_trashcan(course_locs):
|
|||||||
thumbs = store.get_all_content_thumbnails_for_course(course_loc)
|
thumbs = store.get_all_content_thumbnails_for_course(course_loc)
|
||||||
for thumb in thumbs:
|
for thumb in thumbs:
|
||||||
print("Deleting {0}...".format(thumb))
|
print("Deleting {0}...".format(thumb))
|
||||||
store.delete(thumb['_id'])
|
store.delete(thumb['asset_key'])
|
||||||
|
|
||||||
# then delete all of the assets
|
# then delete all of the assets
|
||||||
assets, __ = store.get_all_content_for_course(course_loc)
|
assets, __ = store.get_all_content_for_course(course_loc)
|
||||||
for asset in assets:
|
for asset in assets:
|
||||||
print("Deleting {0}...".format(asset))
|
print("Deleting {0}...".format(asset))
|
||||||
store.delete(asset['_id'])
|
store.delete(asset['asset_key'])
|
||||||
|
|
||||||
|
|
||||||
def restore_asset_from_trashcan(location):
|
def restore_asset_from_trashcan(location):
|
||||||
|
|||||||
Reference in New Issue
Block a user