allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [3/4] git commit: [#5995] avoid 'Neighborhood project missing' during security checks in bootstrap
Date Thu, 21 Mar 2013 00:16:00 GMT
[#5995] avoid 'Neighborhood project missing' during security checks in bootstrap

neighborhood_project is a lazy property, so they very first time a neighborhood project
is created, the check here would return None and then it'd be None for the rest
of the process.  This check isn't needed anyway since there's a unique constraint
on neighborhood_id/shortname for projects.


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

Branch: refs/heads/db/5995
Commit: f6ffa57ff4a034467302db44a90c3a6837814f3d
Parents: a681f4b
Author: Dave Brondsema <dbrondsema@geek.net>
Authored: Wed Mar 20 17:11:46 2013 -0700
Committer: Dave Brondsema <dbrondsema@geek.net>
Committed: Wed Mar 20 17:15:47 2013 -0700

----------------------------------------------------------------------
 Allura/allura/lib/plugin.py         |    4 +---
 Allura/allura/model/neighborhood.py |    4 +++-
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f6ffa57f/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index 3e33172..a3d01b8 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -371,9 +371,7 @@ class ProjectRegistrationProvider(object):
 
     def register_neighborhood_project(self, neighborhood, users, allow_register=False):
         from allura import model as M
-        shortname='--init--'
-        p = neighborhood.neighborhood_project
-        if p: raise forge_exc.ProjectConflict()
+        shortname = '--init--'
         name = 'Home Project for %s' % neighborhood.name
         database_uri = M.Project.default_database_uri(shortname)
         p = M.Project(neighborhood_id=neighborhood._id,

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f6ffa57f/Allura/allura/model/neighborhood.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/neighborhood.py b/Allura/allura/model/neighborhood.py
index b04c0f0..97d96f7 100644
--- a/Allura/allura/model/neighborhood.py
+++ b/Allura/allura/model/neighborhood.py
@@ -73,9 +73,11 @@ class Neighborhood(MappedClass):
     @LazyProperty
     def neighborhood_project(self):
         from .project import Project
-        return Project.query.get(
+        p = Project.query.get(
             neighborhood_id=self._id,
             is_nbhd_project=True)
+        assert p
+        return p
 
     @property
     def acl(self):


Mime
View raw message