diff pylons_app/lib/base.py @ 169:8e01265fb586

added long term caching of repo_list to the base controller. changed hg and repos to use that cached list.
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 21 May 2010 02:17:13 +0200
parents 988477a05db6
children 3380ca40cdba
line wrap: on
line diff
--- a/pylons_app/lib/base.py	Fri May 21 02:13:34 2010 +0200
+++ b/pylons_app/lib/base.py	Fri May 21 02:17:13 2010 +0200
@@ -9,9 +9,9 @@
 from pylons import tmpl_context as c
 from pylons_app.model.hg_model import HgModel
 
-@cache_region('long_term', 'repo_list_2')
-def _get_repos():
-    return [rep['name'] for rep in HgModel().get_repos()]
+@cache_region('long_term', 'cached_repo_list')
+def _get_repos_cached():
+    return [rep for rep in HgModel().get_repos()]
 
 class BaseController(WSGIController):
         
@@ -20,7 +20,7 @@
         # WSGIController.__call__ dispatches to the Controller method
         # the request is routed to. This routing information is
         # available in environ['pylons.routes_dict']
-        c.repo_list = _get_repos()
+        c.cached_repo_list = _get_repos_cached()
         self.sa = meta.Session
         try:
             return WSGIController.__call__(self, environ, start_response)