diff --git a/etiquette/photodb.py b/etiquette/photodb.py index dc9a05c..9f523d6 100644 --- a/etiquette/photodb.py +++ b/etiquette/photodb.py @@ -272,6 +272,11 @@ class PDBAlbumMixin: def get_albums(self): yield from self.get_things(thing_type='album') + def get_root_albums(self): + for album in self.get_albums(): + if album.parent() is None: + yield album + def new_album( self, title=None, diff --git a/etiquette_site.py b/etiquette_site.py index 8a1f839..3de03af 100644 --- a/etiquette_site.py +++ b/etiquette_site.py @@ -351,8 +351,7 @@ def get_album_zip(albumid): def get_albums_core(): - albums = P.get_albums() - albums = [a for a in albums if a.parent() is None] + albums = list(P.get_root_albums()) albums.sort(key=lambda x: x.display_name.lower()) return albums