-
Notifications
You must be signed in to change notification settings - Fork 112
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
Travis Dula - all three #85
base: master
Are you sure you want to change the base?
Conversation
data_list = [] | ||
|
||
# TODO: better (more verbose) errors | ||
@app.route('/data', methods=['GET', 'POST', 'PATCH']) |
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.
How did you decide on what methods are appropriate here? For example would it make sense to include PUT or 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 decided to implement only the requested methods, but with the current model I don't think PUT makes sense. If we had given the ability to create multiple data records, then PUT would be used to create new ones or overwrite existing ones. DELETE could be used in the current model to remove the only list.
try: | ||
data_list = list(sorted([int(request.data)] + data_list)) | ||
return jsonify(data_list) | ||
except BaseException as e: |
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.
How did you decide that BaseException
is the correct exception to use?
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's not ideal to handle exceptions in this manner, but I also cannot think of a situation in which it will behave in an unintended manner. I do notice now though that I didn't do sufficient testing with floats, because those won't work properly here.
Hi, This is Faisal from Headstorm. I looked at your PR and left you a couple of questions to understand your thought process. Good work. |
I learned a lot to do these, and I learned that I have much more to learn. Let me know if you have any questions about my design decisions!