allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [27/34] git commit: [#5007] cache Discussion.last_post property, since it is frequently used in succession
Date Tue, 02 Oct 2012 21:30:28 GMT
[#5007] cache Discussion.last_post property, since it is frequently used in succession


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

Branch: refs/heads/db/4968
Commit: 3d4da8255b25d80ce412c40b34f4a34923f56d48
Parents: 9667df0
Author: Dave Brondsema <dbrondsema@geek.net>
Authored: Thu Sep 27 19:34:10 2012 +0000
Committer: Cory Johns <johnsca@geek.net>
Committed: Fri Sep 28 13:47:14 2012 +0000

----------------------------------------------------------------------
 Allura/allura/lib/app_globals.py |    3 ++-
 Allura/allura/model/discuss.py   |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3d4da825/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index b0d92b2..194765e 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -20,7 +20,8 @@ import pygments.lexers
 import pygments.formatters
 import pygments.util
 from tg import config, session
-from pylons import c, request
+from pylons import request
+from pylons import tmpl_context as c
 from paste.deploy.converters import asbool, asint
 from pypeline.markup import markup as pypeline_markup
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3d4da825/Allura/allura/model/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py
index 931d728..12aa456 100644
--- a/Allura/allura/model/discuss.py
+++ b/Allura/allura/model/discuss.py
@@ -9,6 +9,7 @@ from ming import schema
 from ming.orm.base import session
 from ming.orm.property import (FieldProperty, RelationProperty,
                                ForeignIdProperty)
+from ming.utils import LazyProperty
 
 from allura.lib import helpers as h
 from allura.lib import security
@@ -69,7 +70,7 @@ class Discussion(Artifact, ActivityObject):
         self.num_posts = self.post_class().query.find(
             dict(discussion_id=self._id, status='ok')).count()
 
-    @property
+    @LazyProperty
     def last_post(self):
         q = self.post_class().query.find(dict(
                 discussion_id=self._id)).sort('timestamp', pymongo.DESCENDING)


Mime
View raw message