From fa57386908f7ac7be0b79b31990a7ff5d925996d Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sun, 20 Sep 2020 13:17:51 -0700 Subject: [PATCH] Don't call p.get_tags until needed, and don't sort them. --- etiquette/jsonify.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/etiquette/jsonify.py b/etiquette/jsonify.py index 7b445ce..094bb24 100644 --- a/etiquette/jsonify.py +++ b/etiquette/jsonify.py @@ -37,8 +37,6 @@ def exception(e): return j def photo(p, include_albums=True, include_tags=True): - tags = p.get_tags() - tags = sorted(tags, key=lambda x: x.name) j = { 'type': 'photo', '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()] 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