diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2021-10-18 10:42:47 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2021-10-18 10:42:47 -0700 |
commit | 3752237a30db843fb84a4197d7047f1c34eb5df2 (patch) | |
tree | be18d49210bf51844e0a50b8193da0bf109f4ea4 /python | |
parent | 6cbfaaa5e58ae4c0b482e3573e7e99300a857af8 (diff) | |
download | fatcat-3752237a30db843fb84a4197d7047f1c34eb5df2.tar.gz fatcat-3752237a30db843fb84a4197d7047f1c34eb5df2.zip |
match: fix access_options in return
Diffstat (limited to 'python')
-rw-r--r-- | python/fatcat_web/ref_routes.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/python/fatcat_web/ref_routes.py b/python/fatcat_web/ref_routes.py index 33d2f725..2d8ed413 100644 --- a/python/fatcat_web/ref_routes.py +++ b/python/fatcat_web/ref_routes.py @@ -182,14 +182,18 @@ def reference_match_json(): matches = close_fuzzy_biblio_matches(es_client=app.es_client, biblio=form.data, match_limit=10) or [] else: raise NotImplementedError() + resp = [] for m in matches: # expand releases more completely m.release = api.get_release(m.release.ident, expand="container,files,filesets,webcaptures", hide="abstract,refs") # hack in access options m.access_options = release_access_options(m.release) - # and convert to dict (for jsonify) - m.release = entity_to_dict(m.release) - return jsonify(matches), 200 + # and manually convert to dict (for jsonify) + info = m.__dict__ + info['release'] = entity_to_dict(m.release) + info['access_options'] = [o.dict() for o in m.access_options] + resp.append(info) + return jsonify(resp), 200 else: return Response(json.dumps(dict(errors=form.errors)), mimetype="application/json", status=400) |