Пример #1
0
 def delete_version(cls, version_id):
     version = Version().get(version_id, links=True)
     
     if version is None:
         raise NotFoundException()
     
     # remove the version from storage first
     version.remove()
     
     # then remove the singer and re-index any related objects
     VersionIndex.delete_by_id(version.id)
Пример #2
0
 def delete_song(cls, song_id):
     song = Song().get(song_id, links=True)
     
     if song is None:
         raise NotFoundException()
     
     # remove the song from storage first
     song.remove()
     
     # deleting a song also deletes all the associated versions
     for v in song.versions:
         version = Version().get(v, links=True)
         version.remove()
     
     # then remove the singer and re-index any related objects
     SongIndex.delete_by_id(song.id)