Commits

Ben Bangert committed 2cd07c2

* Updated project templates to use actual config instance, rather than the
StackedObjectProxy classes.
* Changed PylonsConfig to be dict subclass, rather than DispatchingConfig
subclass.

Comments (0)

Files changed (6)

 ================
 
 0.9.7.1 (**branch**)
+* Updated project templates to use actual config instance, rather than the
+  StackedObjectProxy classes.
+* Changed PylonsConfig to be dict subclass, rather than DispatchingConfig
+  subclass.
 
 0.9.7 (February 23, 2009)
 * WARNING: A new option is available to determine whether or not an actions

pylons/templates/default_project/+package+/config/environment.py_tmpl

 {{elif template_engine == 'jinja2'}}
 from jinja2 import ChoiceLoader, Environment, FileSystemLoader
 {{endif}}
-from pylons import config
+from pylons.configuration import PylonsConfig
 {{if template_engine == 'mako'}}
 from pylons.error import handle_mako_error
 {{endif}}
     """Configure the Pylons environment via the ``pylons.config``
     object
     """
+    config = PylonsConfig()
+    
     # Pylons paths
     root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
     paths = dict(root=root,
     # Initialize config with the basic options
     config.init_app(global_conf, app_conf, package='{{package}}', paths=paths)
 
-    config['routes.map'] = make_map()
-    config['pylons.app_globals'] = app_globals.Globals()
+    config['routes.map'] = make_map(config)
+    config['pylons.app_globals'] = app_globals.Globals(config)
     config['pylons.h'] = {{package}}.lib.helpers
     {{if template_engine == 'mako'}}
 
 
     # CONFIGURATION OPTIONS HERE (note: all config options will override
     # any Pylons config options)
+    
+    return config

pylons/templates/default_project/+package+/config/middleware.py_tmpl

 from paste.registry import RegistryManager
 from paste.urlparser import StaticURLParser
 from paste.deploy.converters import asbool
-from pylons import config
 from pylons.middleware import ErrorHandler, StatusCodeRedirect
 from pylons.wsgiapp import PylonsApp
 from routes.middleware import RoutesMiddleware
 
     """
     # Configure the Pylons environment
-    load_environment(global_conf, app_conf)
+    config = load_environment(global_conf, app_conf)
 
     # The Pylons WSGI app
-    app = PylonsApp()
+    app = PylonsApp(config=config)
 
     # Routing/Session/Cache Middleware
     app = RoutesMiddleware(app, config['routes.map'])

pylons/templates/default_project/+package+/config/routing.py_tmpl

 may take precedent over the more generic routes. For more information
 refer to the routes manual at http://routes.groovie.org/docs/
 """
-from pylons import config
 from routes import Mapper
 
-def make_map():
+def make_map(config):
     """Create, configure and return the routes Mapper"""
     map = Mapper(directory=config['pylons.paths']['controllers'],
                  always_scan=config['debug'])

pylons/templates/default_project/+package+/lib/app_globals.py_tmpl

 
     """
 
-    def __init__(self):
+    def __init__(self, config):
         """One instance of Globals is created during application
         initialization and is available during requests via the
         'app_globals' variable

pylons/templates/minimal_project/+package+/wsgiapp.py_tmpl

 from paste.registry import RegistryManager
 from paste.urlparser import StaticURLParser
 from paste.deploy.converters import asbool
-from pylons import config
+from pylons.configuration import PylonsConfig
 {{if template_engine == 'mako'}}
 from pylons.error import handle_mako_error
 {{endif}}
     object
     """
     # Pylons paths
+    config = PylonsConfig()
     root = os.path.dirname(os.path.abspath(__file__))
     paths = dict(root=root,
                  controllers=os.path.join(root, 'controllers'),
     config.init_app(global_conf, app_conf, package='{{package}}',
                     template_engine='{{template_engine}}', paths=paths)
 
-    config['routes.map'] = make_map()
-    config['pylons.app_globals'] = Globals()
+    config['routes.map'] = make_map(config)
+    config['pylons.app_globals'] = Globals(config)
     config['pylons.h'] = {{package}}.helpers
     {{if template_engine == 'mako'}}
 
 
     # CONFIGURATION OPTIONS HERE (note: all config options will override
     # any Pylons config options)
+    
+    return config
 
 
 def make_app(global_conf, full_stack=True, static_files=True, **app_conf):
         defaults to main).
     """
     # Configure the Pylons environment
-    load_environment(global_conf, app_conf)
+    config = load_environment(global_conf, app_conf)
 
     # The Pylons WSGI app
-    app = PylonsApp()
+    app = PylonsApp(config=config)
 
     # Routing/Session/Cache Middleware
     app = RoutesMiddleware(app, config['routes.map'])
 
     """
 
-    def __init__(self):
+    def __init__(self, config):
         """One instance of Globals is created during application
         initialization and is available during requests via the
         'app_globals' variable