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/09 18:46:53 UTC
git commit: [#5091] only do a nbhd project count when the nbhd has a
max project limit
Updated Branches:
refs/heads/db/5091 [created] edbe8b891
[#5091] only do a nbhd project count when the nbhd has a max project limit
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/edbe8b89
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/edbe8b89
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/edbe8b89
Branch: refs/heads/db/5091
Commit: edbe8b891ad2de66d491dcbe4f9ceb4793a77948
Parents: e2e43cf
Author: Dave Brondsema <db...@geek.net>
Authored: Tue Oct 9 16:46:46 2012 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Oct 9 16:46:46 2012 +0000
----------------------------------------------------------------------
Allura/allura/lib/plugin.py | 19 +++++++++----------
1 files changed, 9 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/edbe8b89/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index dc9541c..3c7f73c 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -399,17 +399,16 @@ class ProjectRegistrationProvider(object):
raise ValueError("You can't create private projects for %s neighborhood" % neighborhood.name)
# Check for project limit creation
- pq = M.Project.query.find(dict(
- neighborhood_id=neighborhood._id,
- deleted=False,
- is_nbhd_project=False,
- ))
- count = pq.count()
nb_max_projects = neighborhood.get_max_projects()
-
- if nb_max_projects is not None and count >= nb_max_projects:
- log.exception('Error registering project %s' % project_name)
- raise forge_exc.ProjectOverlimitError()
+ if nb_max_projects is not None:
+ count = M.Project.query.find(dict(
+ neighborhood_id=neighborhood._id,
+ deleted=False,
+ is_nbhd_project=False,
+ )).count()
+ if count >= nb_max_projects:
+ log.exception('Error registering project %s' % project_name)
+ raise forge_exc.ProjectOverlimitError()
self.rate_limit(user, neighborhood)