-
Notifications
You must be signed in to change notification settings - Fork 0
Add writer API and tests #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: reader_api
Are you sure you want to change the base?
Conversation
return flask.jsonify({"error": "Was unable to save document"}), 500 | ||
|
||
|
||
@bp.route("/<region>/runbooks/<book_id>", methods=["PUT", "DELETE"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather prefer to have two separate handlers: one for PUT
and one for DELETE
. Right now it looks like you have one big function which contains only one if ... else ...
statement, moreover two clauses of this if
share only es
and index_name
variables.
# NOTE(kzaitsev): jsonschema exception has really good unicode | ||
# error representation | ||
return flask.jsonify( | ||
{"error": u"{}".format(e)}), 400 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This validation (57-64 lines) looks pretty generic and can be re-used in 96-103 lines if will be created as a decorator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is generic, but writing it as a decorator — I believe would only hurt readability. it's only used in PUT branch of the 2d endpoint, so this decorator would need to somehow handle that. Looks like more code to me
47f5c38
to
f31f7b4
Compare
No description provided.