Blocker for following issues (no more duplicated code):
Duplicated code is ugly, hard to maintain, error prone, unreadable and http://i0.kym-cdn.com/photos/images/newsfeed/001/209/105/7b2.jpeg
test
newline
Why can't you just contribute to a project without making snarky comment? Seriously, this isn't fun when you're on the receiving end of it.
Sorry :cry:
API endpoint requiring a token should have it declared with a decorator, so this is only to check that the token correspond to the expected project.
Here we enforce the presence of the API token :)
Missing _check_repo no?
This check seems to have been lost
This has been lost as well
The check is required, we have API token specific to some project and project-less API token
Same as above :)
And here :)
To fix indeed
Nope (if you mean _check_token), It was moved to earlier place in "issues API: performace: fail early with invalid token", see line 183
It is part of _get_repo() should I extract it into separate function?
_get_repo() contains it
Same reply as above :)
here too :)
Ok
ok
Maybe then I should create a _check_token(require_project_token=True) and cover both cases in that function
_check_token(require_project_token=True)
require_project_token=False in this case
require_project_token=False
Ok, should be there if api_authenticated() as in code later for non-project token?
if api_authenticated()
Isn't then if api_authenticated() duplication when api must be authenticated already as enfoce decorators, or if decorator allows unathenticated querys should be check for repo really there for authenticated?
Thanks for explanation
Ok, I see, thanks
Might make sense, because then we could move get_repo to api/init and re-use it in other API controller
Sounds doable, though I'd suggest a slightly shorter variable name, maybe project_token?
project_token
Well, thanks for the patch :)
sounds good
rebased
Unresolved previously:
 pingou commented 2 days ago API endpoint requiring a token should have it declared with a decorator, so this is only to check that the token correspond to the expected project.  mbasti commented 2 days ago Isn't then if api_authenticated() duplication when api must be authenticated already as enfoce decorators, or if decorator allows unathenticated querys should be check for repo really there for authenticated?
10 new commits added
For this one no, we must be authenticated which should be ensured by @api_login_required
@api_login_required
I'd say this is the final version
pretty please pagure-ci rebuild
Thanks pagure-ci :)
This is looking all good to me as well, let's merge!
Pull-Request has been merged by pingou
Thanks
Well, thank you, this is a pretty awesome PR :)
Blocker for following issues (no more duplicated code):
Duplicated code is ugly, hard to maintain, error prone, unreadable and http://i0.kym-cdn.com/photos/images/newsfeed/001/209/105/7b2.jpeg