allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject allura git commit: [#7919] handle redirecting to subproject; don't redirect to external links
Date Thu, 17 Dec 2015 19:46:44 GMT
Repository: allura
Updated Branches:
  refs/heads/db/8034 65f06ddf0 -> b5970c48c


[#7919] handle redirecting to subproject; don't redirect to external links


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

Branch: refs/heads/db/8034
Commit: b5970c48c9a11149d808f692cb85c4b259f1d41f
Parents: 65f06dd
Author: Dave Brondsema <dave@brondsema.net>
Authored: Thu Dec 17 14:46:39 2015 -0500
Committer: Dave Brondsema <dave@brondsema.net>
Committed: Thu Dec 17 14:46:39 2015 -0500

----------------------------------------------------------------------
 Allura/allura/ext/admin/admin_main.py | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/b5970c48/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 d891e83..6dc0603 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -654,6 +654,11 @@ class ProjectAdminController(BaseController):
         redirect('tools')
 
     def _update_mounts(self, subproject=None, tool=None, new=None, **kw):
+        '''
+
+        Returns the new App or Subproject, if one was installed.
+        Returns None otherwise.
+        '''
         if subproject is None:
             subproject = []
         if tool is None:
@@ -703,6 +708,7 @@ class ProjectAdminController(BaseController):
                     sp.ordinal = int(new['ordinal'])
                 else:
                     sp.ordinal = c.project.last_ordinal_value() + 1
+                new_app = sp
             else:
                 require_access(c.project, 'admin')
                 installable_tools = AdminApp.installable_tools_for(c.project)
@@ -739,7 +745,13 @@ class ProjectAdminController(BaseController):
         try:
             new_app = self._update_mounts(subproject, tool, new, **kw)
             if new_app:
-                redirect(new_app.url)
+                if getattr(new_app, 'tool_label', '') == 'External Link':
+                    flash(u'{} installed successfully.'.format(new_app.tool_label))
+                else:
+                    new_url = new_app.url
+                    if callable(new_url):  # subprojects have a method instead of property
+                        new_url = new_url()
+                    redirect(new_url)
         except forge_exc.ForgeError, exc:
             flash('%s: %s' % (exc.__class__.__name__, exc.args[0]),
                   'error')


Mime
View raw message