When would repo not be set? Could you add a comment here explaining when that would happen for future readers?
I'm a little newer to flask. Is setting things like this flask.g a common convention? Does this basically just add objects to this request? If so, why not tack on to flask.request? Finally, does setting objects on flask.g only affect the current request being handled, and not other simultaneous requests (i.e., is this thread safe?)
flask.g
It seems like it could be confusing to future readers to overwrite the repo variable here, since it is a parameter in the top of the function. I see that you are setting repo to reponame at the top of the function. Perhaps you could call this repo_object, or just use flask.g.repo everywhere instead so it's not so confusing?
The above is just a suggestion, feel free to ignore.
Why would this change from 403 to 404?
This looks great, so much code de-duplication!
1 new commit added
LGTM!
I didn't want to use repo_obj as I already use it everywhere for the pygit2 repository object, but I'll adjust to use plain flask.g.repo, thanks :)
repo_obj
flask.g.repo
Because the existence of the git repo is now done prior to the check if the user is allowed to do the action.
I should move up the creation of the git so that we can still also check the 403.
Thanks
7 new commits added
3 new commits added
rebased
:thumbsup:
Thanks for the review @vivekanand1101
I'll wait a bit before merging in case @bowlofeggs wants to have a look at the final changes since he did the first set :)
s/retrieve/retrieves/
s/provide/provides/
Maybe add a comment here explaining why this is happening?
This seems like a really nice approach since it doesn't require so many decorators. Even more code de-duplication!
Nice work @pingou, LGTM!
Thanks for the review @vivekanand1101 and @bowlofeggs, it wasn't a small one :)
Pull-Request has been merged by pingou