You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2012/10/02 23:30:28 UTC

[21/34] git commit: update-neighborhood-home-tool accepts an ObjectId in addition to nbhd full name, to match set-neighborhood-features

update-neighborhood-home-tool accepts an ObjectId in addition to nbhd full name, to match set-neighborhood-features


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

Branch: refs/heads/db/4968
Commit: edd11ab01d6b50cef63d6398aa5ce6a24b284928
Parents: 43300c2
Author: Dave Brondsema <db...@geek.net>
Authored: Fri Sep 28 15:52:07 2012 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Fri Sep 28 15:52:07 2012 +0000

----------------------------------------------------------------------
 Allura/allura/command/create_neighborhood.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/edd11ab0/Allura/allura/command/create_neighborhood.py
----------------------------------------------------------------------
diff --git a/Allura/allura/command/create_neighborhood.py b/Allura/allura/command/create_neighborhood.py
index 93b9e6a..e629ae8 100644
--- a/Allura/allura/command/create_neighborhood.py
+++ b/Allura/allura/command/create_neighborhood.py
@@ -1,6 +1,7 @@
 from . import base
 
 from ming.orm import session
+from bson import ObjectId
 
 from allura import model as M
 from allura.lib import plugin, exceptions
@@ -30,9 +31,9 @@ class CreateNeighborhoodCommand(base.Command):
 class UpdateNeighborhoodCommand(base.Command):
     min_args=3
     max_args=None
-    usage = '<ini file> <neighborhood_shortname> <home_tool_active>'
+    usage = '<ini file> <neighborhood> <home_tool_active>'
     summary = 'Activate Home application for neighborhood\r\n' \
-        '\t<neighborhood> - the neighborhood name\r\n' \
+        '\t<neighborhood> - the neighborhood name or _id\r\n' \
         '\t<value> - boolean value to install/uninstall Home tool\r\n' \
         '\t    must be True or False\r\n\r\n' \
         '\tExample:\r\n' \
@@ -43,6 +44,8 @@ class UpdateNeighborhoodCommand(base.Command):
         self.basic_setup()
         shortname = self.args[1]
         nb = M.Neighborhood.query.get(name=shortname)
+        if not nb:
+            nb = M.Neighborhood.query.get(_id=ObjectId(shortname))
         if nb is None:
             raise exceptions.NoSuchNeighborhoodError("The neighborhood %s " \
                 "could not be found in the database" % shortname)