diff pylons_app/model/hg_model.py @ 482:7afbc45aab28 celery

added caching queries to hg-app
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 17 Sep 2010 21:35:46 +0200
parents fdebc5f67dc6
children 853b9425742a
line wrap: on
line diff
--- a/pylons_app/model/hg_model.py	Fri Sep 17 21:26:53 2010 +0200
+++ b/pylons_app/model/hg_model.py	Fri Sep 17 21:35:46 2010 +0200
@@ -43,16 +43,14 @@
     raise Exception('Unable to import vcs')
 
 def _get_repos_cached_initial(app_globals, initial):
-    """
-    return cached dict with repos
+    """return cached dict with repos
     """
     g = app_globals
     return HgModel.repo_scan(g.paths[0][0], g.paths[0][1], g.baseui, initial)
 
 @cache_region('long_term', 'cached_repo_list')
 def _get_repos_cached():
-    """
-    return cached dict with repos
+    """return cached dict with repos
     """
     log.info('getting all repositories list')
     from pylons import app_globals as g
@@ -62,7 +60,8 @@
 def _get_repos_switcher_cached(cached_repo_list):
     repos_lst = []
     for repo in sorted(x for x in cached_repo_list.values()):
-        if HasRepoPermissionAny('repository.write', 'repository.read', 'repository.admin')(repo.name.lower(), 'main page check'):
+        if HasRepoPermissionAny('repository.write', 'repository.read',
+                    'repository.admin')(repo.name.lower(), 'main page check'):
             repos_lst.append((repo.name.lower(), repo.dbrepo.private,))
     
     return repos_lst
@@ -73,14 +72,11 @@
     return list(reversed(list(HgModel().get_repo(repo_name))))
 
 class HgModel(object):
-    """
-    Mercurial Model
+    """Mercurial Model
     """
 
     def __init__(self):
-        """
-        Constructor
-        """
+        pass
     
     @staticmethod
     def repo_scan(repos_prefix, repos_path, baseui, initial=False):
@@ -92,8 +88,7 @@
         """
         sa = meta.Session()
         def check_repo_dir(path):
-            """
-            Checks the repository
+            """Checks the repository
             :param path:
             """
             repos_path = path.split('/')