incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [23/50] git commit: [#6456] Refactored ProjectImporterDispatcher to Allura to remove dependency on FI
Date Thu, 08 Aug 2013 13:34:42 GMT
[#6456] Refactored ProjectImporterDispatcher to Allura to remove dependency on FI

Signed-off-by: Cory Johns <cjohns@slashdotmedia.com>


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

Branch: refs/heads/tv/6458
Commit: 4ed7af81a3f595f4081f966f7d2547671e73f8b5
Parents: 868694e
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Tue Jul 23 18:26:48 2013 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Wed Jul 31 18:44:34 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/project.py  | 14 ++++++++++++--
 ForgeImporters/forgeimporters/base.py | 15 ++++-----------
 2 files changed, 16 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4ed7af81/Allura/allura/controllers/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/project.py b/Allura/allura/controllers/project.py
index 8af4396..d2b8510 100644
--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -20,6 +20,7 @@ import logging
 from datetime import datetime, timedelta
 from urllib import unquote
 from itertools import chain, islice
+from pkg_resources import iter_entry_points
 
 from bson import ObjectId
 from tg import expose, flash, redirect, validate, request, response, config
@@ -47,7 +48,6 @@ from allura.lib.widgets import forms as ff
 from allura.lib.widgets import form_fields as ffw
 from allura.lib.widgets import project_list as plw
 from allura.lib import plugin, exceptions
-from forgeimporters.base import ProjectImporterDispatcher
 from .auth import AuthController
 from .search import SearchController, ProjectBrowseController
 from .static import NewForgeController
@@ -74,7 +74,7 @@ class NeighborhoodController(object):
         self.browse = NeighborhoodProjectBrowseController(neighborhood=self.neighborhood)
         self._admin = NeighborhoodAdminController(self.neighborhood)
         self._moderate = NeighborhoodModerateController(self.neighborhood)
-        self.import_project = ProjectImporterDispatcher(self.neighborhood)
+        self.import_project = ProjectImporterController(self.neighborhood)
 
     def _check_security(self):
         require_access(self.neighborhood, 'read')
@@ -919,3 +919,13 @@ class GrantController(object):
         with h.push_context(self.project._id):
             g.post_event('project_updated')
         redirect(request.referer)
+
+class ProjectImporterController(object):
+    def __init__(self, neighborhood, *a, **kw):
+        super(ProjectImporterController, self).__init__(*a, **kw)
+        self.neighborhood = neighborhood
+
+    @expose()
+    def _lookup(self, source, *rest):
+        for ep in iter_entry_points('allura.project_importers', source):
+            return ep.load()(self.neighborhood), rest

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4ed7af81/ForgeImporters/forgeimporters/base.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/base.py b/ForgeImporters/forgeimporters/base.py
index 777eb8a..bf22f8a 100644
--- a/ForgeImporters/forgeimporters/base.py
+++ b/ForgeImporters/forgeimporters/base.py
@@ -25,18 +25,9 @@ from ming.utils import LazyProperty
 from allura.controllers import BaseController
 
 
-class ProjectImporterDispatcher(BaseController):
-    def __init__(self, neighborhood, *a, **kw):
-        super(ProjectImporterDispatcher, self).__init__(*a, **kw)
-        self.neighborhood = neighborhood
-
-    @expose()
-    def _lookup(self, source, *rest):
-        for ep in iter_entry_points('allura.project_importers', source):
-            return ep.load()(self.neighborhood), rest
-
-
 class ProjectImporter(BaseController):
+    """
+    """
     source = None
 
     @LazyProperty
@@ -73,6 +64,8 @@ class ProjectImporter(BaseController):
 
 
 class ToolImporter(object):
+    """
+    """
     target_app = None  # app or list of apps
     source = None  # string description of source, must match project importer
     controller = None


Mime
View raw message