incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [14/41] git commit: [#6535] ticket:417 rebased master and 42cc_6533
Date Thu, 19 Sep 2013 16:21:46 GMT
[#6535] ticket:417 rebased master and 42cc_6533


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

Branch: refs/heads/db/5822
Commit: fd9404a699ac4ad6ac268836c32dabddbba6eb3e
Parents: 6062bc7
Author: Anton Kasyanov <mind1master@gmail.com>
Authored: Tue Aug 27 14:03:32 2013 +0300
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Thu Sep 19 14:46:49 2013 +0000

----------------------------------------------------------------------
 ForgeImporters/forgeimporters/github/__init__.py | 17 +++++------------
 ForgeImporters/forgeimporters/github/tracker.py  |  2 --
 2 files changed, 5 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fd9404a6/ForgeImporters/forgeimporters/github/__init__.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/github/__init__.py b/ForgeImporters/forgeimporters/github/__init__.py
index 8e1a802..13d32e4 100644
--- a/ForgeImporters/forgeimporters/github/__init__.py
+++ b/ForgeImporters/forgeimporters/github/__init__.py
@@ -27,21 +27,14 @@ log = logging.getLogger(__name__)
 
 class GitHubProjectExtractor(base.ProjectExtractor):
     PAGE_MAP = {
-            'project_info': 'https://api.github.com/repos/{project}',
-            'issues': 'https://api.github.com/repos/{project}/issues',
+            'project_info': 'https://api.github.com/repos/{project_name}',
+            'issues': 'https://api.github.com/repos/{project_name}/issues',
         }
     POSSIBLE_STATES = ('opened', 'closed')
 
     def parse_page(self, page):
         return json.loads(page.read().decode('utf8'))
 
-    def __init__(self, allura_project, gh_project_name, page):
-        self.project = allura_project
-        self.gh_project_name = gh_project_name
-        self.url = self.PAGE_MAP[page].format(
-            project=urllib.quote(gh_project_name),
-        )
-
     def get_summary(self):
         return self.get_page('project_info').get('description')
 
@@ -54,12 +47,12 @@ class GitHubProjectExtractor(base.ProjectExtractor):
     def iter_issues(self):
         # github api doesn't allow getting closed and opened tickets in one query
         issues = []
-        self.url += '?state={state}'
+        url = self.get_page_url('issues') + '?state={state}'
         for state in self.POSSIBLE_STATES:
-            issue_list_url = self.url.format(
+            issue_list_url = url.format(
                 state=state,
             )
-            issues += json.loads(urllib2.urlopen(issue_list_url).read().decode('utf8'))
+            issues += json.loads(self.urlopen(issue_list_url).read().decode('utf8'))
         issues.sort(key=lambda x: x['number'])
         for issue in issues:
             yield (issue['number'], issue)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fd9404a6/ForgeImporters/forgeimporters/github/tracker.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/github/tracker.py b/ForgeImporters/forgeimporters/github/tracker.py
index 4cd433b..af5363d 100644
--- a/ForgeImporters/forgeimporters/github/tracker.py
+++ b/ForgeImporters/forgeimporters/github/tracker.py
@@ -35,9 +35,7 @@ class GitHubTrackerImporter(ToolImporter):
             )
         ThreadLocalORMSession.flush_all()
         extractor = GitHubProjectExtractor(
-            project,
             '{}/{}'.format(kw['user_name'],project_name),
-            'issues',
         )
         try:
             M.session.artifact_orm_session._get().skip_mod_date = True


Mime
View raw message