incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [02/26] git commit: [#6007] Add helpful text and a list of projects to the default nbhd wikis
Date Tue, 04 Jun 2013 22:17:06 GMT
[#6007] Add helpful text and a list of projects to the default nbhd wikis


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

Branch: refs/heads/cj/6325
Commit: 9436995f27d71d48b6b185fc7c5162106c1f19de
Parents: 9d78948
Author: Dave Brondsema <dbrondsema@geek.net>
Authored: Mon Mar 25 13:53:08 2013 -0700
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Tue Jun 4 14:40:51 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/index.py                       |    2 +-
 .../allura/tests/functional/test_neighborhood.py   |    2 +-
 Allura/allura/websetup/bootstrap.py                |   35 ++++++++++++++-
 3 files changed, 36 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9436995f/Allura/allura/model/index.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/index.py b/Allura/allura/model/index.py
index 2dedf4d..f7e3538 100644
--- a/Allura/allura/model/index.py
+++ b/Allura/allura/model/index.py
@@ -199,7 +199,7 @@ class Shortlink(object):
         p_shortname = None
         p_id = None
         p_nbhd = None
-        if hasattr(c, 'project'):
+        if getattr(c, 'project', None):
             p_shortname = getattr(c.project, 'shortname', None)
             p_id = getattr(c.project, '_id', None)
             p_nbhd = c.project.neighborhood_id

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9436995f/Allura/allura/tests/functional/test_neighborhood.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_neighborhood.py b/Allura/allura/tests/functional/test_neighborhood.py
index c45d50e..07c4ccb 100644
--- a/Allura/allura/tests/functional/test_neighborhood.py
+++ b/Allura/allura/tests/functional/test_neighborhood.py
@@ -51,7 +51,7 @@ class TestNeighborhood(TestController):
         r = self.app.get('/adobe/wiki/')
         assert r.location.endswith('/adobe/wiki/Home/')
         r = r.follow()
-        assert 'Welcome' in str(r), str(r)
+        assert 'This is the "Adobe" neighborhood' in str(r), str(r)
         r = self.app.get('/adobe/admin/', extra_environ=dict(username='test-user'),
                          status=403)
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9436995f/Allura/allura/websetup/bootstrap.py
----------------------------------------------------------------------
diff --git a/Allura/allura/websetup/bootstrap.py b/Allura/allura/websetup/bootstrap.py
index dd98580..5e8ab1e 100644
--- a/Allura/allura/websetup/bootstrap.py
+++ b/Allura/allura/websetup/bootstrap.py
@@ -23,7 +23,7 @@ import sys
 import logging
 import shutil
 from collections import defaultdict
-from datetime import datetime
+from textwrap import dedent
 
 import tg
 from pylons import tmpl_context as c, app_globals as g
@@ -40,6 +40,8 @@ from allura.websetup import schema
 from allura.command import EnsureIndexCommand
 from allura.command import CreateTroveCategoriesCommand
 
+from forgewiki import model as WM
+
 log = logging.getLogger(__name__)
 
 def cache_test_data():
@@ -121,6 +123,37 @@ def bootstrap(command, conf, vars):
     p_projects = project_reg.register_neighborhood_project(n_projects, [root], allow_register=True)
     p_users = project_reg.register_neighborhood_project(n_users, [root])
     p_adobe = project_reg.register_neighborhood_project(n_adobe, [root])
+
+    def set_nbhd_wiki_content(nbhd_proj, content):
+        wiki = nbhd_proj.app_instance('wiki')
+        page = WM.Page.query.get(app_config_id=wiki.config._id, title=wiki.root_page_name)
+        page.text = content
+
+    set_nbhd_wiki_content(p_projects, dedent('''
+        Welcome to the "Projects" neighborhood.  It is the default neighborhood in Allura.
+        You can edit this wiki page as you see fit.  Here's a few ways to get started:
+
+        [Register a new project](/p/add_project)
+
+        [Neighborhood administration](/p/admin)
+
+        [[projects show_total=yes]]
+        '''))
+    set_nbhd_wiki_content(p_users, dedent('''
+        This is the "Users" neighborhood.  All users automatically get a user-project created
for them, using their username.
+
+        [Neighborhood administration](/u/admin)
+
+        [[projects show_total=yes]]
+        '''))
+    set_nbhd_wiki_content(p_adobe, dedent('''
+        This is the "Adobe" neighborhood.  It is just an example of having projects in a
different neighborhood.
+
+        [Neighborhood administration](/adobe/admin)
+
+        [[projects show_total=yes]]
+        '''))
+
     ThreadLocalORMSession.flush_all()
     ThreadLocalORMSession.close_all()
 


Mime
View raw message