Open
Conversation
Closed
akscram
suggested changes
Dec 21, 2016
| 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.
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.
This validation (57-64 lines) looks pretty generic and can be re-used in 96-103 lines if will be created as a decorator.
Collaborator
Author
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.