Skip to content

Conversation

hkethi002
Copy link
Contributor

Fixes #331

Review Checklist

  • Tests were added to cover all code changes
  • Documentation was added / updated
  • Code and tests follow standards in CONTRIBUTING.md

@hkethi002 hkethi002 requested a review from nagem July 19, 2017 14:40
permchecker(noop)('PUT')


payload = self.request.json_body
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would technically 500 if the PUT contained no request body, not just {}.

permchecker(noop)('PUT')


payload = self.request.json_body
Copy link
Contributor

@nagem nagem Jul 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We check that the payload exists everywhere, it would be nice to have a decorator such as @verify_payload_exists that just does this for us. Feel free to add one if you'd like :)


try:
result = self.storage.update_el(_id, payload)
except APIStorageException as e:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would only ever get thrown when we can't transform the _id to an ObjectId. We have route filters that require an ObjectId structure. I think allowing the APIStorageException to bubble up on it's own and cause a 500 is a better way to handle it, it would show us where there are holes in the filter, if any.

@nagem
Copy link
Contributor

nagem commented Jul 20, 2017

Overall looks good, I did make some comments on code that is following existing examples in our codebase, but those existing examples have issues I'd like to correct with time. Mind correcting them here and we can go back and cleanup problems as we have time?

@hkethi002 hkethi002 force-pushed the analysis-put branch 2 times, most recently from 5a6c7c2 to 6acb738 Compare July 25, 2017 16:36
@nagem
Copy link
Contributor

nagem commented Jul 26, 2017

I simplified the decorator, with that change LGTM!

@hkethi002 hkethi002 merged commit 6dfc506 into master Jul 26, 2017
@hkethi002 hkethi002 deleted the analysis-put branch July 26, 2017 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants