Use PDB.get_tags_by_id for Photo.get_tags.

This commit is contained in:
voussoir 2018-04-28 19:14:58 -07:00
parent b19682d1a5
commit 62496d183e

View file

@ -884,11 +884,12 @@ class Photo(ObjectBase):
''' '''
Return the tags assigned to this Photo. Return the tags assigned to this Photo.
''' '''
generator = self.photodb.sql_select( tag_ids = self.photodb.sql_select(
'SELECT tagid FROM photo_tag_rel WHERE photoid == ?', 'SELECT tagid FROM photo_tag_rel WHERE photoid == ?',
[self.id] [self.id]
) )
tags = [self.photodb.get_tag(id=fetch[0]) for fetch in generator] tag_ids = [row[0] for row in tag_ids]
tags = list(self.photodb.get_tags_by_id(tag_ids))
return tags return tags
def has_tag(self, tag, *, check_children=True): def has_tag(self, tag, *, check_children=True):