From b9d2e62d9253af5bdafeef77f242682c0a951184 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 13 Oct 2021 16:46:23 -0700 Subject: web: editor username /u/ helper --- python/fatcat_web/routes.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'python/fatcat_web') diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py index 41027710..e9741b6d 100644 --- a/python/fatcat_web/routes.py +++ b/python/fatcat_web/routes.py @@ -606,6 +606,14 @@ def editor_annotations(ident): return render_template('editor_annotations.html', editor=editor, annotations=annotations) +@app.route('/u/', methods=['GET', 'HEAD']) +def editor_username_redirect(username): + try: + editor = api.lookup_editor(username=username) + except ApiException as ae: + abort(ae.status) + return redirect(f'/editor/{editor.editor_id}') + @app.route('/changelog', methods=['GET']) def changelog_view(): try: -- cgit v1.2.3