diff pylons_app/controllers/repos.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 b68b2246e5a6
line wrap: on
line diff
--- a/pylons_app/controllers/repos.py	Fri May 21 02:13:34 2010 +0200
+++ b/pylons_app/controllers/repos.py	Fri May 21 02:17:13 2010 +0200
@@ -26,9 +26,7 @@
     def index(self, format='html'):
         """GET /repos: All items in the collection"""
         # url('repos')
-        hg_model = HgModel()
-        c.repos_list = list(hg_model.get_repos())
-        c.repos_list.sort(key=itemgetter('name'))
+        c.repos_list = c.cached_repo_list
         return render('admin/repos/repos.html')
     
     def create(self):
@@ -64,7 +62,7 @@
         shutil.move(rm_path, os.path.join(path, 'rm__%s-%s' % (datetime.today(), id)))
         
         #clear our cached list for refresh with new repo
-        invalidate_cache('repo_list_2')
+        invalidate_cache('cached_repo_list')
                     
         return redirect(url('repos'))