You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2012/10/26 21:33:21 UTC
[1/26] git commit: [#4942] Gracefully handle bad / missing tools
Updated Branches:
refs/heads/cj/4942 c99db981e -> 0a275a165 (forced update)
[#4942] Gracefully handle bad / missing tools
Forward-ported from https://sourceforge.net/p/allura/git/merge-requests/9/
Signed-off-by: Cory Johns <jo...@geek.net>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/0a275a16
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/0a275a16
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/0a275a16
Branch: refs/heads/cj/4942
Commit: 0a275a1659b335ce3397e104dd4072bd773de6c7
Parents: cf03d39
Author: Cory Johns <jo...@geek.net>
Authored: Fri Oct 26 19:32:14 2012 +0000
Committer: Cory Johns <jo...@geek.net>
Committed: Fri Oct 26 19:32:20 2012 +0000
----------------------------------------------------------------------
Allura/allura/model/project.py | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0a275a16/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index 9580b25..bf5b453 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -404,7 +404,12 @@ class Project(MappedClass, ActivityNode, ActivityObject):
for ac in self.app_configs:
if excluded_tools and ac.tool_name in excluded_tools:
continue
- App = ac.load()
+ # Tool could've been uninstalled in the meantime
+ try:
+ App = ac.load()
+ # If so, we don't want it listed
+ except KeyError:
+ continue
app = App(self, ac)
if app.is_visible_to(c.user):
for sm in app.main_menu():
@@ -533,8 +538,8 @@ class Project(MappedClass, ActivityNode, ActivityObject):
for sub in self.direct_subprojects:
result.append({'ordinal':int(sub.ordinal), 'sub':sub, 'rank':1})
for ac in self.app_configs:
- App = g.entry_points['tool'][ac.tool_name]
- if include_hidden or not App.hidden:
+ App = g.entry_points['tool'].get(ac.tool_name)
+ if include_hidden or App and not App.hidden:
ordinal = ac.options.get('ordinal', 0)
rank = 0 if ac.options.get('mount_point', None) == 'home' else 1
result.append({'ordinal':int(ordinal), 'ac':ac, 'rank':rank})