From 735fbf9abd9734d26fdad2e7931ef86f9bccf98c Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Wed, 30 Sep 2020 13:41:42 -0700 Subject: [PATCH] Let the purge methods yield their deleted items. --- etiquette/photodb.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etiquette/photodb.py b/etiquette/photodb.py index b923b00..06e98d2 100644 --- a/etiquette/photodb.py +++ b/etiquette/photodb.py @@ -121,6 +121,7 @@ class PDBAlbumMixin: album_ids = sqlhelpers.listify(a.id for a in albums) query += f' AND albumid IN {album_ids}' self.sql_execute(query) + yield from directories @decorators.transaction def purge_empty_albums(self, albums=None): @@ -138,6 +139,7 @@ class PDBAlbumMixin: # This may have been the last child of an otherwise empty parent. to_check.update(album.get_parents()) album.delete() + yield album #################################################################################################### @@ -535,6 +537,7 @@ class PDBPhotoMixin: if photo.real_path.exists: continue photo.delete() + yield photo def search( self,