Mercurial > kallithea
diff pylons_app/config/environment.py @ 43:2e1247e62c5b
changed for pylons 0.1 / 1.0
added admin controller
author | marcink |
---|---|
date | Wed, 07 Apr 2010 15:28:50 +0200 |
parents | 71ffa932799d |
children | 3ada2f409c1c |
line wrap: on
line diff
--- a/pylons_app/config/environment.py Wed Apr 07 13:24:46 2010 +0200 +++ b/pylons_app/config/environment.py Wed Apr 07 15:28:50 2010 +0200 @@ -3,12 +3,14 @@ import os from mako.lookup import TemplateLookup +from pylons.configuration import PylonsConfig from pylons.error import handle_mako_error -from pylons import config +from sqlalchemy import engine_from_config import pylons_app.lib.app_globals as app_globals import pylons_app.lib.helpers from pylons_app.config.routing import make_map +from pylons_app.model import init_model log = logging.getLogger(__name__) @@ -16,6 +18,8 @@ """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, @@ -24,12 +28,16 @@ templates=[os.path.join(root, 'templates')]) # Initialize config with the basic options - config.init_app(global_conf, app_conf, package='pylons_app', - template_engine='mako', paths=paths) + config.init_app(global_conf, app_conf, package='pylons_app', 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'] = pylons_app.lib.helpers + + # Setup cache object as early as possible + import pylons + pylons.cache._push_object(config['pylons.app_globals'].cache) + # Create the Mako TemplateLookup, with the default auto-escaping config['pylons.app_globals'].mako_lookup = TemplateLookup( @@ -39,5 +47,22 @@ input_encoding='utf-8', default_filters=['escape'], imports=['from webhelpers.html import escape']) + #sets the c attribute access when don't existing attribute ar accessed + config['pylons.strict_tmpl_context'] = False + + #MULTIPLE DB configs + # Setup the SQLAlchemy database engine +# if config['debug']: +# #use query time debugging. +# from pylons_app.lib.timer_proxy import TimerProxy +# sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.', +# proxy=TimerProxy()) +# else: +# sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.') + + #init_model(sa_engine_db1) + # CONFIGURATION OPTIONS HERE (note: all config options will override # any Pylons config options) + + return config