def delete_asset(course_key, asset_key):
 try:
  content = contentstore().find(asset_key)
 except NotFoundError:
  raise AssetNotFoundException
 contentstore('trashcan').save(content)
 if (content.thumbnail_location is not None):
  thumbnail_location = course_key.make_asset_key('thumbnail', asset_key.name)
  try:
   thumbnail_content = contentstore().find(thumbnail_location)
   contentstore('trashcan').save(thumbnail_content)
   contentstore().delete(thumbnail_content.get_id())
   del_cached_content(thumbnail_location)
  except Exception:
   logging.warning('Could not delete thumbnail: %s', thumbnail_location)
 contentstore().delete(content.get_id())
 del_cached_content(content.location)

def delete_asset ( course_key , asset_key ) : try : content = contentstore ( ) . find ( asset_key ) except NotFoundError : raise AssetNotFoundException contentstore ( 'trashcan' ) . save ( content ) if ( content . thumbnail_location is not None ) : thumbnail_location = course_key . make_asset_key ( 'thumbnail' , asset_key . name ) try : thumbnail_content = contentstore ( ) . find ( thumbnail_location ) contentstore ( 'trashcan' ) . save ( thumbnail_content ) contentstore ( ) . delete ( thumbnail_content . get_id ( ) ) del_cached_content ( thumbnail_location ) except Exception : logging . warning ( 'Could not delete thumbnail: %s' , thumbnail_location ) contentstore ( ) . delete ( content . get_id ( ) ) del_cached_content ( content . location )
deletes asset represented by given asset_key in the course represented by given course_key .