Don't call p.get_tags until needed, and don't sort them.

This commit is contained in:
voussoir 2020-09-20 13:17:51 -07:00
parent f56da72881
commit fa57386908

View file

@ -37,8 +37,6 @@ def exception(e):
return j return j
def photo(p, include_albums=True, include_tags=True): def photo(p, include_albums=True, include_tags=True):
tags = p.get_tags()
tags = sorted(tags, key=lambda x: x.name)
j = { j = {
'type': 'photo', 'type': 'photo',
'id': p.id, 'id': p.id,
@ -62,7 +60,7 @@ def photo(p, include_albums=True, include_tags=True):
j['albums'] = [album(a, minimal=True) for a in p.get_containing_albums()] j['albums'] = [album(a, minimal=True) for a in p.get_containing_albums()]
if include_tags: if include_tags:
j['tags'] = [tag(t, minimal=True) for t in tags] j['tags'] = [tag(t, minimal=True) for t in p.get_tags()]
return j return j