allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject allura git commit: [#7804] ticket:687 Use OAuth token for project validation
Date Tue, 02 Dec 2014 16:52:55 GMT
Repository: allura
Updated Branches:
  refs/heads/master e03a459c6 -> 142a867c9


[#7804] 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/142a867c
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/142a867c
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/142a867c

Branch: refs/heads/master
Commit: 142a867c958520b25980110bbe231b74a581ebec
Parents: e03a459
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Wed Nov 26 14:16:58 2014 +0000
Committer: Igor Bondarenko <jetmind2@gmail.com>
Committed: Tue Dec 2 07:00:29 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/142a867c/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):


Mime
View raw message