incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [13/16] git commit: [#5502] ticket:505 Check `installable` instead of `max_instances > 0`
Date Wed, 18 Dec 2013 21:05:57 GMT
[#5502] ticket:505 Check `installable` instead of `max_instances > 0`


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

Branch: refs/heads/master
Commit: 60b62ecb8e10e57259da1e8215c0801543439e1d
Parents: cae7c5e
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Wed Dec 18 14:03:44 2013 +0200
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Wed Dec 18 20:38:58 2013 +0000

----------------------------------------------------------------------
 Allura/allura/app.py                                     |  2 +-
 Allura/allura/ext/admin/admin_main.py                    | 11 +++++++----
 .../templates/widgets/neighborhood_add_project.html      |  2 +-
 3 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/60b62ecb/Allura/allura/app.py
----------------------------------------------------------------------
diff --git a/Allura/allura/app.py b/Allura/allura/app.py
index 0a87d21..46aaa04 100644
--- a/Allura/allura/app.py
+++ b/Allura/allura/app.py
@@ -488,7 +488,7 @@ class Application(object):
         not be installed directly by a user, but may be uninstalled).
 
         """
-        return self.max_instances > 0
+        return self.installable
 
     def main_menu(self):
         """Return a list of :class:`SitemapEntries <allura.app.SitemapEntry>`

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/60b62ecb/Allura/allura/ext/admin/admin_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/admin_main.py b/Allura/allura/ext/admin/admin_main.py
index 535993f..44e5ecb 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -32,6 +32,7 @@ from tg.decorators import with_trailing_slash, without_trailing_slash
 from webob import exc
 from bson import ObjectId
 from ming.orm.ormsession import ThreadLocalORMSession
+from ming.odm import session
 
 from allura.app import Application, DefaultAdminController, SitemapEntry
 from allura.lib import helpers as h
@@ -106,14 +107,16 @@ class AdminApp(Application):
                     limited_tools.append(tool.tool_name)
 
         tools = []
-        for k, v in g.entry_points['tool'].iteritems():
-            if k not in limited_tools and v.max_instances > 0:
-                tools.append(dict(name=k, app=v))
+        for name, App in g.entry_points['tool'].iteritems():
+            cfg = M.AppConfig(project_id=project._id, tool_name=name)
+            app = App(project, cfg)
+            if name not in limited_tools and app.installable:
+                tools.append(dict(name=name, app=App))
+            session(cfg).expunge(cfg)  # prevent from saving temporary config to db
         tools.sort(key=lambda t: (t['app'].status_int(), t['app'].ordinal))
         return [t for t in tools
             if t['app'].status in project.allowed_tool_status]
 
-
     @staticmethod
     def exportable_tools_for(project):
         tools = []

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/60b62ecb/Allura/allura/templates/widgets/neighborhood_add_project.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/neighborhood_add_project.html b/Allura/allura/templates/widgets/neighborhood_add_project.html
index bf46d32..ca21381 100644
--- a/Allura/allura/templates/widgets/neighborhood_add_project.html
+++ b/Allura/allura/templates/widgets/neighborhood_add_project.html
@@ -50,7 +50,7 @@
     {% if not neighborhood.project_template %}
     {% for opt in widget.fields.tools.options %}
         {% set tool = g.entry_points["tool"][opt.html_value] %}
-        {% if tool.max_instances > 0 %}
+        {% if tool.installable %}
         <div class="tool">
             <img src="{{ g.theme.app_icon_url(tool, 48) }}" alt="{{ opt.label }} icon">
             <input checked type="checkbox" value="{{ opt.html_value }}"


Mime
View raw message