incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [1/2] git commit: [#5971] don't re-query the Users nbhd every time we look up a user-project
Date Fri, 29 Mar 2013 15:24:28 GMT
Updated Branches:
  refs/heads/master 34729f5cc -> 53635e778


[#5971] don't re-query the Users nbhd every time we look up a user-project


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

Branch: refs/heads/master
Commit: 53635e778f61d8a8a20f0205caa45eabdbe0d143
Parents: d7846b2
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
Authored: Thu Mar 28 19:12:50 2013 +0000
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Fri Mar 29 15:23:59 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/auth.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/53635e77/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index ee9abec..5ccfd60 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -23,6 +23,7 @@ from ming.orm import session, state
 from ming.orm import FieldProperty, RelationProperty, ForeignIdProperty
 from ming.orm.declarative import MappedClass
 from ming.orm.ormsession import ThreadLocalORMSession
+from ming.utils import LazyProperty
 
 import allura.tasks.mail_tasks
 from allura.lib import helpers as h
@@ -583,6 +584,11 @@ class User(MappedClass, ActivityNode, ActivityObject):
                                user=user, user_project=True)
         return user
 
+    @LazyProperty
+    def neighborhood(self):
+        from allura import model as M
+        return M.Neighborhood.query.get(name='Users')
+
     def private_project(self):
         '''
         Returns the personal user-project for the user
@@ -591,7 +597,7 @@ class User(MappedClass, ActivityNode, ActivityObject):
             return None
 
         from allura import model as M
-        n = M.Neighborhood.query.get(name='Users')
+        n = self.neighborhood
         auth_provider = plugin.AuthenticationProvider.get(request)
         project_shortname = auth_provider.user_project_shortname(self)
         p = M.Project.query.get(shortname=project_shortname, neighborhood_id=n._id)


Mime
View raw message