Mercurial > public > src > rhodecode
diff pylons_app/controllers/hg.py @ 245:a83a1799480c
Reimplemented way of caching repos list, hg model now get's repos objects right from cached dict, this way we skipp creating instances of MercurialRepository and gain performance. Some import cleanup
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Thu, 03 Jun 2010 00:04:48 +0200 |
parents | 4cf00c939e88 |
children | 3782a6d698af |
line wrap: on
line diff
--- a/pylons_app/controllers/hg.py Tue Jun 01 22:19:03 2010 +0200 +++ b/pylons_app/controllers/hg.py Thu Jun 03 00:04:48 2010 +0200 @@ -1,10 +1,11 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -import logging from operator import itemgetter from pylons import tmpl_context as c, request, config +from pylons_app.lib.auth import LoginRequired from pylons_app.lib.base import BaseController, render -from pylons_app.lib.auth import LoginRequired +from pylons_app.model.hg_model import HgModel +import logging log = logging.getLogger(__name__) class HgController(BaseController): @@ -18,12 +19,12 @@ cs = c.current_sort c.cs_slug = cs.replace('-', '') sortables = ['name', 'description', 'last_change', 'tip', 'contact'] - + cached_repo_list = HgModel().get_repos() if cs and c.cs_slug in sortables: sort_key = c.cs_slug + '_sort' if cs.startswith('-'): - c.repos_list = sorted(c.cached_repo_list, key=itemgetter(sort_key), reverse=True) + c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key), reverse=True) else: - c.repos_list = sorted(c.cached_repo_list, key=itemgetter(sort_key), reverse=False) + c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key), reverse=False) return render('/index.html')