]>
gitweb.michael.orlitzky.com - dead/census-tools.git/blob - www/maps/maps/config/environment.py
1 """Pylons environment configuration"""
4 from mako
.lookup
import TemplateLookup
5 from pylons
import config
6 from pylons
.error
import handle_mako_error
8 import maps
.lib
.app_globals
as app_globals
9 import maps
.lib
.helpers
10 from maps
.config
.routing
import make_map
12 def load_environment(global_conf
, app_conf
):
13 """Configure the Pylons environment via the ``pylons.config``
17 root
= os
.path
.dirname(os
.path
.dirname(os
.path
.abspath(__file__
)))
18 paths
= dict(root
=root
,
19 controllers
=os
.path
.join(root
, 'controllers'),
20 static_files
=os
.path
.join(root
, 'public'),
21 templates
=[os
.path
.join(root
, 'templates')])
23 # Initialize config with the basic options
24 config
.init_app(global_conf
, app_conf
, package
='maps', paths
=paths
)
26 config
['routes.map'] = make_map()
27 config
['pylons.app_globals'] = app_globals
.Globals()
28 config
['pylons.h'] = maps
.lib
.helpers
30 # Create the Mako TemplateLookup, with the default auto-escaping
31 config
['pylons.app_globals'].mako_lookup
= TemplateLookup(
32 directories
=paths
['templates'],
33 error_handler
=handle_mako_error
,
34 module_directory
=os
.path
.join(app_conf
['cache_dir'], 'templates'),
35 input_encoding
='utf-8', default_filters
=['escape'],
36 imports
=['from webhelpers.html import escape'])
38 # CONFIGURATION OPTIONS HERE (note: all config options will override
39 # any Pylons config options)
40 config
['pylons.strict_c'] = True