diff pylons_app/lib/base.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 fdcef6ea3b55
children d303aacb3349
line wrap: on
line diff
--- a/pylons_app/lib/base.py	Tue Jun 01 22:19:03 2010 +0200
+++ b/pylons_app/lib/base.py	Thu Jun 03 00:04:48 2010 +0200
@@ -2,24 +2,15 @@
 
 Provides the BaseController class for subclassing.
 """
-from beaker.cache import cache_region
 from pylons import config, tmpl_context as c, request, session
 from pylons.controllers import WSGIController
 from pylons.templating import render_mako as render
 from pylons_app.lib.auth import LoginRequired, AuthUser
 from pylons_app.lib.utils import get_repo_slug
 from pylons_app.model import meta
-from pylons_app.model.hg_model import HgModel
+from pylons_app.model.hg_model import _get_repos_cached
 from pylons_app import __version__
 
-@cache_region('long_term', 'cached_repo_list')
-def _get_repos_cached():
-    return [rep for rep in HgModel().get_repos()]
-
-@cache_region('long_term', 'full_changelog')
-def _full_changelog_cached(repo_name):
-    return list(reversed(list(HgModel().get_repo(repo_name))))  
-
 class BaseController(WSGIController):
     
     def __before__(self):