You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2014/11/26 18:09:49 UTC

allura git commit: [#10034] ticket:687 Use OAuth token for project validation

Repository: allura
Updated Branches:
  refs/heads/ib/10034 [created] 9930db52b


[#10034] ticket:687 Use OAuth token for project validation

Or else github will return 403 (probably only if request limit is reached)
and user will see "This project is unavailable for import" message


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/9930db52
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/9930db52
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/9930db52

Branch: refs/heads/ib/10034
Commit: 9930db52b1b414d3df386469b41f0cb59c3e8ca3
Parents: 5dfecc5
Author: Igor Bondarenko <je...@gmail.com>
Authored: Wed Nov 26 14:16:58 2014 +0000
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Wed Nov 26 14:16:58 2014 +0000

----------------------------------------------------------------------
 ForgeImporters/forgeimporters/github/__init__.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/9930db52/ForgeImporters/forgeimporters/github/__init__.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/github/__init__.py b/ForgeImporters/forgeimporters/github/__init__.py
index 434e639..51ba1f1 100644
--- a/ForgeImporters/forgeimporters/github/__init__.py
+++ b/ForgeImporters/forgeimporters/github/__init__.py
@@ -50,7 +50,7 @@ class GitHubProjectNameValidator(fev.FancyValidator):
         if not re.match(r'^[a-zA-Z0-9-_.]+$', project_name):
             raise fev.Invalid(self.message('invalid', state), value, state)
 
-        if not GitHubProjectExtractor(full_project_name).check_readable():
+        if not GitHubProjectExtractor(full_project_name, user=c.user).check_readable():
             raise fev.Invalid(self.message('unavailable', state), value, state)
         return project_name
 
@@ -107,7 +107,7 @@ class GitHubProjectExtractor(base.ProjectExtractor):
         return resp
 
     def check_readable(self):
-        resp = requests.head(self.get_page_url('project_info'))
+        resp = requests.head(self.add_token(self.get_page_url('project_info')))
         return resp.status_code == 200
 
     def get_next_page_url(self, link):