comparison pylons_app/config/environment.py @ 32:f93b523c0be3

dirty fix for multiple file encodings,
author Marcin Kuzminski <marcin@python-blog.com>
date Fri, 05 Mar 2010 01:14:30 +0100
parents 5f30a6d558dc
children 71ffa932799d
comparison
equal deleted inserted replaced
31:2963f2894a7a 32:f93b523c0be3
16 """Configure the Pylons environment via the ``pylons.config`` 16 """Configure the Pylons environment via the ``pylons.config``
17 object 17 object
18 """ 18 """
19 # Pylons paths 19 # Pylons paths
20 root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 20 root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
21 paths = dict(root = root, 21 paths = dict(root=root,
22 controllers = os.path.join(root, 'controllers'), 22 controllers=os.path.join(root, 'controllers'),
23 static_files = os.path.join(root, 'public'), 23 static_files=os.path.join(root, 'public'),
24 templates = [os.path.join(root, 'templates')]) 24 templates=[os.path.join(root, 'templates')])
25 25
26 # Initialize config with the basic options 26 # Initialize config with the basic options
27 config.init_app(global_conf, app_conf, package = 'pylons_app', 27 config.init_app(global_conf, app_conf, package='pylons_app',
28 template_engine = 'mako', paths = paths) 28 template_engine='mako', paths=paths)
29 29
30 config['routes.map'] = make_map() 30 config['routes.map'] = make_map()
31 config['pylons.g'] = app_globals.Globals() 31 config['pylons.g'] = app_globals.Globals()
32 config['pylons.h'] = pylons_app.lib.helpers 32 config['pylons.h'] = pylons_app.lib.helpers
33 33
34 # Create the Mako TemplateLookup, with the default auto-escaping 34 # Create the Mako TemplateLookup, with the default auto-escaping
35 config['pylons.g'].mako_lookup = TemplateLookup( 35 config['pylons.g'].mako_lookup = TemplateLookup(
36 directories = paths['templates'], 36 directories=paths['templates'],
37 error_handler = handle_mako_error, 37 error_handler=handle_mako_error,
38 module_directory = os.path.join(app_conf['cache_dir'], 'templates'), 38 module_directory=os.path.join(app_conf['cache_dir'], 'templates'),
39 input_encoding = 'utf-8', output_encoding = 'utf-8', 39 output_encoding='utf-8',
40 imports = ['from webhelpers.html import escape'], 40 imports=['from webhelpers.html import escape'],
41 default_filters = ['escape']) 41 default_filters=['escape'])
42 42
43 # CONFIGURATION OPTIONS HERE (note: all config options will override 43 # CONFIGURATION OPTIONS HERE (note: all config options will override
44 # any Pylons config options) 44 # any Pylons config options)