changeset 134:79a4f9f1cbd6

Moved cached function for easier invalidation
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 09 May 2010 13:20:34 +0200
parents 919b5bcd8630
children 28f28d423268
files pylons_app/lib/base.py
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/pylons_app/lib/base.py	Sun May 09 13:08:16 2010 +0200
+++ b/pylons_app/lib/base.py	Sun May 09 13:20:34 2010 +0200
@@ -9,21 +9,18 @@
 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()]
+
 class BaseController(WSGIController):
-    def _load_repos(self):
-                
-        @cache_region('long_term', 'repo_list_2')
-        def _get_repos():
-            return [rep['name'] for rep in HgModel().get_repos()]
-        
-        c.repo_list = _get_repos()
         
     def __call__(self, environ, start_response):
         """Invoke the Controller"""
         # WSGIController.__call__ dispatches to the Controller method
         # the request is routed to. This routing information is
         # available in environ['pylons.routes_dict']
-        self._load_repos()
+        c.repo_list = _get_repos()
         try:
             return WSGIController.__call__(self, environ, start_response)
         finally: