From: W. Trevor King Date: Sun, 21 Sep 2014 12:22:56 +0000 (-0700) Subject: nmhive.py: Add GET /tags X-Git-Tag: v0.1.0~26 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3eba9b8c2c3a1736549cbe6f5dfcb8fd05da62ab;p=nmhive.git nmhive.py: Add GET /tags We don't want bookmarklet users adding random tags. Instead, restrict them to tags that are already in the database, which allows us to keep a consistent tag-set and present a simpler UI. The hard-coded _AVAILABLE_TAGS will be replaced by a notmuch query once I finish with the UI. --- diff --git a/nmhive.py b/nmhive.py index 08c61fc..363a1b8 100755 --- a/nmhive.py +++ b/nmhive.py @@ -13,9 +13,22 @@ app = flask.Flask(__name__) flask_cors.CORS(app) +_AVAILABLE_TAGS = { + 'bug', + 'needs-review', + 'obsolete', + 'patch', + } _TAGS = {} +@app.route('/tags', methods=['GET']) +def tags(): + return flask.Response( + response=json.dumps(sorted(_AVAILABLE_TAGS)), + mimetype='application/json') + + @app.route('/mid/', methods=['GET', 'POST']) def message_id_tags(message_id): if flask.request.method == 'POST':