allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kentontay...@apache.org
Subject allura git commit: Lazy load /tree controller (self._commit.tree can run compute_tree_new and svn info2 for example), and run .ls() only once
Date Wed, 09 Jan 2019 17:52:31 GMT
Repository: allura
Updated Branches:
  refs/heads/master d69e4176a -> b42c8c91b


Lazy load /tree controller (self._commit.tree can run compute_tree_new and svn info2 for example),
and run .ls() only once


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

Branch: refs/heads/master
Commit: b42c8c91b4404ebbfb1251f6f34d66d9dbef4235
Parents: d69e417
Author: Dave Brondsema <dave@brondsema.net>
Authored: Mon Jan 7 17:56:42 2019 -0500
Committer: Kenton Taylor <ktaylor@slashdotmedia.com>
Committed: Wed Jan 9 17:52:15 2019 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/repository.py               | 6 +++++-
 Allura/allura/templates/widgets/repo/tree_widget.html | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/b42c8c91/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index 48a80f8..8dfe8aa 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -22,6 +22,7 @@ from datetime import datetime
 from urllib import quote, unquote
 from collections import defaultdict, OrderedDict
 
+from ming.utils import LazyProperty
 from paste.deploy.converters import asbool
 from pylons import tmpl_context as c, app_globals as g
 from pylons import request, response
@@ -648,7 +649,10 @@ class CommitBrowser(BaseController):
         c.revision = revision
         if self._commit is None:
             raise exc.HTTPNotFound
-        self.tree = self.TreeBrowserClass(self._commit, tree=self._commit.tree)
+
+    @LazyProperty
+    def tree(self):
+        return self.TreeBrowserClass(self._commit, tree=self._commit.tree)
 
     @expose('jinja:allura:templates/repo/commit.html')
     @validate(dict(page=validators.Int(if_empty=0, if_invalid=0),

http://git-wip-us.apache.org/repos/asf/allura/blob/b42c8c91/Allura/allura/templates/widgets/repo/tree_widget.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/repo/tree_widget.html b/Allura/allura/templates/widgets/repo/tree_widget.html
index 3cb0f9e..14dd26a 100644
--- a/Allura/allura/templates/widgets/repo/tree_widget.html
+++ b/Allura/allura/templates/widgets/repo/tree_widget.html
@@ -40,7 +40,7 @@
     {% if not ls %}
     <tr><td colspan="5">&mdash; No files &mdash;</td></tr>
    {% endif %}
-    {% for dirent in tree.ls() %}
+    {% for dirent in ls %}
     <tr>
       <td class="nowrap">
         {% if dirent.kind == 'DIR' %}


Mime
View raw message