incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [2/3] git commit: [#6007] Add helpful text and a list of projects to the default nbhd wikis
Date Tue, 26 Mar 2013 15:54:49 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/0aa7bc05
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/0aa7bc05
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/0aa7bc05

Branch: refs/heads/db/6007
Commit: 0aa7bc0540786063d1a3eb0ff388d7fdc1e4a161
Parents: d2678d1
Author: Dave Brondsema <dbrondsema@geek.net>
Authored: Mon Mar 25 13:53:08 2013 -0700
Committer: Dave Brondsema <dbrondsema@geek.net>
Committed: Tue Mar 26 11:54:34 2013 -0400

----------------------------------------------------------------------
 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/0aa7bc05/Allura/allura/model/index.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/index.py b/Allura/allura/model/index.py
index 3a93a0a..1b53eed 100644
--- a/Allura/allura/model/index.py
+++ b/Allura/allura/model/index.py
@@ -182,7 +182,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/0aa7bc05/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 9c86a67..02e3760 100644
--- a/Allura/allura/tests/functional/test_neighborhood.py
+++ b/Allura/allura/tests/functional/test_neighborhood.py
@@ -34,7 +34,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/0aa7bc05/Allura/allura/websetup/bootstrap.py
----------------------------------------------------------------------
diff --git a/Allura/allura/websetup/bootstrap.py b/Allura/allura/websetup/bootstrap.py
index 9614b99..09a1a91 100644
--- a/Allura/allura/websetup/bootstrap.py
+++ b/Allura/allura/websetup/bootstrap.py
@@ -5,7 +5,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
@@ -22,6 +22,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():
@@ -102,6 +104,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