Return-Path: X-Original-To: apmail-incubator-allura-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-allura-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 76B231048A for ; Mon, 3 Jun 2013 20:55:39 +0000 (UTC) Received: (qmail 42906 invoked by uid 500); 3 Jun 2013 20:55:39 -0000 Delivered-To: apmail-incubator-allura-commits-archive@incubator.apache.org Received: (qmail 42887 invoked by uid 500); 3 Jun 2013 20:55:39 -0000 Mailing-List: contact allura-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: allura-dev@incubator.apache.org Delivered-To: mailing list allura-commits@incubator.apache.org Received: (qmail 42872 invoked by uid 99); 3 Jun 2013 20:55:39 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Jun 2013 20:55:39 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 2F6D8812A6F; Mon, 3 Jun 2013 20:55:39 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: johnsca@apache.org To: allura-commits@incubator.apache.org Date: Mon, 03 Jun 2013 20:55:40 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [2/4] git commit: [#6007] Add helpful text and a list of projects to the default nbhd wikis [#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/c8812228 Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/c8812228 Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/c8812228 Branch: refs/heads/cj/6007 Commit: c8812228ac6448dbcf3dd9549690aeb5f5c4f5b7 Parents: cf25d5e Author: Dave Brondsema Authored: Mon Mar 25 13:53:08 2013 -0700 Committer: Cory Johns Committed: Mon Jun 3 20:08:11 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/c8812228/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/c8812228/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/c8812228/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()