From acc9b67a20a8e5ad7177f6a29e8f56c998db0452 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Wed, 21 Mar 2018 18:48:38 -0700 Subject: [PATCH] Add parameter minimal to jsonify.tag. --- etiquette/jsonify.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/etiquette/jsonify.py b/etiquette/jsonify.py index 86397c7..26c11f3 100644 --- a/etiquette/jsonify.py +++ b/etiquette/jsonify.py @@ -62,18 +62,20 @@ 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) for t in tags] + j['tags'] = [tag(t, minimal=True) for t in tags] return j -def tag(t, include_synonyms=False): +def tag(t, include_synonyms=False, minimal=False): j = { 'id': t.id, - 'author': user_or_none(t.get_author()), 'name': t.name, - 'description': t.description, - 'qualified_name': t.qualified_name(), } + if not minimal: + j['author'] = user_or_none(t.get_author()) + j['description'] = t.description + j['qualified_name'] = t.qualified_name() + if include_synonyms: j['synonyms'] = list(t.get_synonyms()) return j