diff pylons_app/lib/app_globals.py @ 341:1ef52a70f3b7

Made config file free configuration based on database and capable of beeing manage via application settings + some code cleanups
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 14 Jul 2010 02:28:32 +0200
parents 48727add84c9
children 0d4fceb91c9c
line wrap: on
line diff
--- a/pylons_app/lib/app_globals.py	Fri Jul 09 02:38:17 2010 +0200
+++ b/pylons_app/lib/app_globals.py	Wed Jul 14 02:28:32 2010 +0200
@@ -2,10 +2,9 @@
 
 from beaker.cache import CacheManager
 from beaker.util import parse_cache_config_options
-from pylons_app.lib.utils import make_ui
+from vcs.utils.lazy import LazyProperty
 
 class Globals(object):
-
     """Globals acts as a container for objects available throughout the
     life of the application
 
@@ -18,8 +17,17 @@
 
         """
         self.cache = CacheManager(**parse_cache_config_options(config))
-        self.baseui = make_ui(config['hg_app_repo_conf'])
-        self.paths = self.baseui.configitems('paths')
-        self.base_path = self.paths[0][1].replace('*', '')
         self.changeset_annotation_colors = {}
-        self.available_permissions = None # propagated after init_model
+        self.available_permissions = None   # propagated after init_model
+        self.app_title = None               # propagated after init_model
+        self.baseui = None                  # propagated after init_model        
+        
+    @LazyProperty
+    def paths(self):
+        if self.baseui:
+            return self.baseui.configitems('paths')
+    
+    @LazyProperty
+    def base_path(self):
+        if self.baseui:
+            return self.paths[0][1].replace('*', '')